Mechanize for Python 3.x

扶醉桌前 提交于 2019-11-30 07:07:10

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()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!