开发者

Python Mechanize keeps giving me 'response_seek_wrapper' when I try to use .open

I'm not sure what's going on, as the script used to work (before I messed around with my python on my system...)

But when I try something along the lines of

import mechanize
browser = mechanize.Browser()
browser.open("http://google.com")

I get something like

<response_seek_wrapper at 0x10123fd88 whose wrapped object = <cl开发者_JAVA百科oseable_response at 0x101232170 whose fp = <socket._fileobject object at 0x1010bf5f0>>>

Does anyone know why this is and what the fix is?

thanks!


it's not an exception, is it?
nothing wrong is happening, you just got a return value, which is esentially a response object, equivalent to br.response().

see

>>> r = browser.open("http://google.com")
>>> r
<response_seek_wrapper at 0x9bb116c whose wrapped object = <closeable_response at 0x9bb426c whose fp = <socket._fileobject object at 0x9ba306c>>>
>>> r.info().headers
# see the response headers

vs

>>> browser.open("http://google.com")
>>> browser.response()
<response_seek_wrapper at 0x9c229cc whose wrapped object = <closeable_response at 0x9bb426c whose fp = <socket._fileobject object at 0x9ba306c>>>
>>> browser.response().info().headers
# see the response headers
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜