Can mechanize completely replace queries [python]

I found a python2 project on GitHub and wanted to translate it to python3. I was just wondering if requests and mechanization are basically the same and can be swapped for each other.

+3


source to share


1 answer


Not. While they have the same functionality, they definitely don't overlap. The mechanism seems to have more than requests. Mechanization has the ability to "resolve" forms on a page, where "Requests" are more about simply pulling in a raw HTML page or interacting with a web API. A different library is required for requests to get this function. You can replace Mehchanize with MechanicalSoup . Actually the creator started MechanicalSoup because Mechanize hasn't been ported to 3. * yet.



I was a gracious user of the Mechanize library, but unfortunately it is incompatible with Python 3 and development is inactive. MechanicalSoup provides a similar API built on requests from the giants Python (for http sessions) and BeautifulSoup (for navigating documents).

+3


source







All Articles