Seekable output from ClientForm?

Matej Cepl cepl at surfbest.net
Wed Feb 9 16:38:56 EST 2005


Hi,

using python 2.3, ClientForm, and ClientCookie and I have this code:

opener = ClientCookie.build_opener(ClientCookie.HTTPRefererProcessor,
                                   ClientCookie.HTTPRefreshProcessor,
                                   ClientCookie.SeekableProcessor)

response = opener.open(lxURL)
forms = ClientForm.ParseResponse(response)
form = forms[0]
response.seek(0)

form['extpatid'] = MyNEUlogin
form['extpatpw'] = MyNEUpassword
formopener = form.click()

response2 = ClientCookie.urlopen(formopener)
guidednews = re.compile("s_guidednews.html")

response2.seek(0)
h = htmllib.HTMLParser(formatter.NullFormatter())
h.feed(response2.read())
print h.anchorlist

Unfortunately, it doesn't work, because response2 was created by
ClientForm and it is not seekable (apparently, I get "AttributeError:
addinfourl instance has no attribute 'seek'").

How to make output of ClientForm seekable, please?

Thanks a lot,

Matej



More information about the Python-list mailing list