开发者

Mechanize for Python 3.x

is there any way how to use Mechanize with Python 3.x?

Or is there any substitute which works in Python 3.x?

I've been searching for hours, but I didn't find 开发者_如何学运维anything :(

I'm looking for way how to login to the site with Python, but the site uses javascript.

Thanks in advance,

Adam.


lxml.html provides form handling facilities and supports Python 3.


I'm working on a similar project, but the faq for mechanize explicitly says they don't intend on supporting 3x any time soon. Is there a reason the code has to be written in 3?

The way I'm trying to tackle the problem is by emulating the java script with form submits, it takes some reverse engineering. (which is, if the javascript ends by submitting a form, and you can find the arguments the script passes to the submit(), just follow the example from the mechanize doc

http://wwwsearch.sourceforge.net/mechanize/

br.select_form(name="order")
# Browser passes through unknown attributes (including methods)
# to the selected HTMLForm.
br["cheeses"] = ["mozzarella", "caerphilly"]  # (the method here is __setitem__)
# Submit current form.  Browser calls .close() on the current response on
# navigation, so this closes response1
response2 = br.submit()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜