Skip to main content

mechanize - Automate interaction with HTTP web servers

Latest version released on PyPi Build status of the master branch

Major features

Stateful programmatic web browsing in Python

  • The browser class mechanize.Browser implements the interface of urllib2.OpenerDirector, so any URL can be opened not just http.

  • Easy HTML form filling.

  • Convenient link parsing and following.

  • Browser history (.back() and .reload() methods).

  • The Referer HTTP header is added properly (optional).

  • Automatic observance of robots.txt.

  • Automatic handling of HTTP-Equiv and Refresh.

Installation

To install for normal usage:

pip3 install mechanize

To install for development:

git clone https://github.com/python-mechanize/mechanize.git
cd mechanize
pip3 install -e .

To install manually, simply add the mechanize sub-directory somewhere on your PYTHONPATH.

Documentation

See https://mechanize.readthedocs.io/en/latest/

Credits

python-mechanize was the creation of John J. Lee. Maintenance was taken over by Kovid Goyal in 2017.

Much of the code was originally derived from the work of the following people:

  • Gisle Aas – [libwww-perl]

  • Jeremy Hylton (and many others) – [urllib2]

  • Andy Lester – [WWW::Mechanize]

  • Johnny Lee (coincidentally-named) – MSIE CookieJar Perl code from which mechanize’s support for that is derived.

Also:

  • Gary Poster and Benji York at Zope Corporation – contributed significant changes to the HTML forms code

  • Ronald Tschalar – provided help with Netscape cookies

Thanks also to the many people who have contributed bug reports and patches.

Release files for mechanize 0.4.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mechanize 0.4.11
File Size Uploaded Provenance Actions
mechanize-0.4.11.tar.gz 221.0 kB Without provenance Details for mechanize-0.4.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mechanize 0.4.11
File Interpreter ABI Platform Actions
mechanize-0.4.11-py2.py3-none-any.whl Python 3, Python 2 none any Details for mechanize-0.4.11-py2.py3-none-any.whl

Total release size: 331.9 kB

Release files / mechanize-0.4.11.tar.gz

Download URL mechanize-0.4.11.tar.gz
Size 221.0 kB
Tags Source
SHA-256 checksum
How to use checksums
544d1e5c97a03f20e726551fea80b5fe46db720491746923e89c9c6960c4b7e8
BLAKE2b-256 checksum
How to use checksums
be681cf35b16ee3006e22b6aaf997434d7a204a6c29b2d0a6840c58a2db88d9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / mechanize-0.4.11-py2.py3-none-any.whl

Download URL mechanize-0.4.11-py2.py3-none-any.whl
Size 110.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
be6a20109689c8f03cd084d4428cb1a544fba1d490cdea0a51e05151af87a1e3
BLAKE2b-256 checksum
How to use checksums
f628836729b877a1e8ca96ab018405601c56c0cfc059486d4ac58fd1fdd9983a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for mechanize 0.4.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.11 This release

2 release files No provenance

0.1.7b

0.1.6b

0.1.5b

0.1.4b

0.1.2b

0.1.1a

0.1.0a

0.0.11a

0.0.10a

0.0.9a

0.0.8a

0.0.1a

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page