| 1 |
mechanize - Automate interaction with HTTP web servers |
| 2 |
########################################################## |
| 3 |
|
| 4 |
|pypi| |build| |
| 5 |
|
| 6 |
.. contents:: |
| 7 |
|
| 8 |
|
| 9 |
Major features |
| 10 |
----------------- |
| 11 |
|
| 12 |
Stateful programmatic web browsing in Python |
| 13 |
|
| 14 |
- The browser class `mechanize.Browser` implements the |
| 15 |
interface of `urllib2.OpenerDirector`, so any URL can |
| 16 |
be opened not just `http`. |
| 17 |
|
| 18 |
- Easy HTML form filling. |
| 19 |
|
| 20 |
- Convenient link parsing and following. |
| 21 |
|
| 22 |
- Browser history (`.back()` and `.reload()` methods). |
| 23 |
|
| 24 |
- The `Referer` HTTP header is added properly (optional). |
| 25 |
|
| 26 |
- Automatic observance of `robots.txt <http://www.robotstxt.org/wc/norobots.html>`_. |
| 27 |
|
| 28 |
- Automatic handling of HTTP-Equiv and Refresh. |
| 29 |
|
| 30 |
|
| 31 |
Installation |
| 32 |
----------------- |
| 33 |
|
| 34 |
To install for normal usage: |
| 35 |
|
| 36 |
.. code-block:: bash |
| 37 |
|
| 38 |
pip3 install mechanize |
| 39 |
|
| 40 |
To install for development: |
| 41 |
|
| 42 |
.. code-block:: bash |
| 43 |
|
| 44 |
git clone https://github.com/python-mechanize/mechanize.git |
| 45 |
cd mechanize |
| 46 |
pip3 install -e . |
| 47 |
|
| 48 |
To install manually, simply add the `mechanize` sub-directory somewhere on your |
| 49 |
`PYTHONPATH`. |
| 50 |
|
| 51 |
|
| 52 |
Documentation |
| 53 |
--------------- |
| 54 |
|
| 55 |
See https://mechanize.readthedocs.io/en/latest/ |
| 56 |
|
| 57 |
Credits |
| 58 |
----------------- |
| 59 |
|
| 60 |
python-mechanize was the creation of John J. Lee. Maintenance was taken over by |
| 61 |
Kovid Goyal in 2017. |
| 62 |
|
| 63 |
Much of the code was originally derived from the work of the following people: |
| 64 |
|
| 65 |
- Gisle Aas -- [libwww-perl] |
| 66 |
|
| 67 |
- Jeremy Hylton (and many others) -- [urllib2] |
| 68 |
|
| 69 |
- Andy Lester -- [WWW::Mechanize] |
| 70 |
|
| 71 |
- Johnny Lee (coincidentally-named) -- MSIE CookieJar Perl code from which |
| 72 |
mechanize's support for that is derived. |
| 73 |
|
| 74 |
Also: |
| 75 |
|
| 76 |
- Gary Poster and Benji York at Zope Corporation -- contributed significant |
| 77 |
changes to the HTML forms code |
| 78 |
|
| 79 |
- Ronald Tschalar -- provided help with Netscape cookies |
| 80 |
|
| 81 |
Thanks also to the many people who have contributed bug reports and |
| 82 |
patches. |
| 83 |
|
| 84 |
.. |pypi| image:: https://img.shields.io/pypi/v/mechanize.svg?label=version |
| 85 |
:target: https://pypi.python.org/pypi/mechanize |
| 86 |
:alt: Latest version released on PyPi |
| 87 |
|
| 88 |
.. |build| image:: https://dev.azure.com/divok/mechanize/_apis/build/status/python-mechanize.mechanize?branchName=master |
| 89 |
:target: https://dev.azure.com/divok/mechanize/_build/latest?definitionId=3&branchName=master |
| 90 |
:alt: Build status of the master branch |