Are there any alternatives to Mechanize in Python? [closed]

隐身守侯 提交于 2019-12-03 06:51:28

问题


I'm using Python 3.6 while I have to fill in a form. Unfortunately, mechanize doesn't work on Python 3. What do you suggest as an alternative to mechanize?


回答1:


SeleniumRC with selenium.py is an alternative (and one of the few workable options if the pages you need to scrape have an important, "structural" role for Javascript operations, esp. AJAX-y ones, since Mechanize doesn't execute the Javascript on the pages it's scraping).




回答2:


For scraping and form handling you can use lxml.html (it doesn't automate fetching and cookies though).

scrapy is a library specifically for scraping.




回答3:


I've been successful with Splinter, a solution built on top of Selenium - while providing more pythonic API.




回答4:


I've used twill for a lot of my testing needs. It works as a stand-alone language for "web browsing" or as a library from Python. It actually uses Mechanize under the hood, so I'm not sure if it will meet your needs -- are you encountering problems intrinsic to Mechanize, or would you benefit from a high level layer?




回答5:


try zope.browser http://pypi.python.org/pypi?:action=display&name=zope.testbrowser




回答6:


scrapelib is another option : https://github.com/sunlightlabs/scrapelib



来源:https://stackoverflow.com/questions/2662705/are-there-any-alternatives-to-mechanize-in-python

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