471,601 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

Seekable output from ClientForm?

Hi,

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

opener = ClientCookie.build_opener(ClientCookie.HTTPReferer Processor,
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
Jul 18 '05 #1
2 1585
mac
In article <35*************************@posting.google.com> , Matej Cepl wrote:
Hi,

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

opener = ClientCookie.build_opener(ClientCookie.HTTPReferer Processor,
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?


Instead of:
response2 = ClientCookie.urlopen(formopener)
try:
opener.open(formopener)

Cheers,
Maciek

Jul 18 '05 #2
Thanks a lot!

Matej

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by narke | last post: by
reply views Thread by kostem | last post: by
reply views Thread by m0sf3t | last post: by
reply views Thread by Joe Johnson | last post: by
reply views Thread by dany_gates | last post: by
1 post views Thread by Gordon Airporte | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.