Georg Brandl <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > Hello all, please correct me, if I do... > > from ClientForm import ParseResponse > > from urllib2 import urlopen > > ... > > response=urlopen(url) > > forms=ParseResponse(response) > > I won't be able to > > print response.read() > > in order to see HTML source anymore. In other words I will see only > > an > > empty string. Suggestions? > > response = urlopen(url) > content = response.read() > > forms = ParseResponse(content) > > i.e., adapt ParseResponse to accept a string, or wrap the string in a > StringIO: > > import cStringIO > forms = ParseResponse(cStringIO.StringIO(content))
That won't work, because a StringIO does not support the 'response' interface required of ParseResponse's argument. You may use ClientForm.ParseFile on the StringIO instead. Use response.geturl() to get the URL that ParseFile wants. John -- http://mail.python.org/mailman/listinfo/python-list