Archive your statuses, favorites and media using the Mastodon API (i.e. login required)
Mastodon.py
Call the Mastodon API from Python with Mastodon.py, a wrapper for the service’s API.

About Mastodon.py
Mastodon.py is an open source Python library that wraps the Mastodon API, so Python code can interact with Mastodon servers. The README describes it as feature complete for the public API as of Mastodon version 4.5.8. It is installed from PyPI with pip.
The README shows the basic workflow: register an application once per server, log in through an OAuth authorization code, then create an API instance with the saved access token to post a status. Full documentation and basic usage examples are hosted on Read the Docs, and more extensive examples are in a separate GitHub repository. The library is released under the MIT license.
Key features
- Python wrapper for the Mastodon API
- Covers the public API, as of Mastodon version 4.5.8
- App registration and OAuth login with saved credential files
- Posts a status with a single method call
- Installable from PyPI using pip
- Basic docs on Read the Docs and extended examples in a separate repository
- Open source and released under the MIT license
- Includes basic documentation and separate extended usage examples
- Provides contact channels for questions and bug reports
- Python 2 support is no longer a goal
- Support for Python 3.7 and later is a stated aim, not a guarantee
- Feature completeness is stated for the public API only
Mastodon.py at a glance
- Website
- github.com/halcy/Mastodon.py
- Category
- Social & Communities › Fediverse
- Type
- Open-source project
- Pricing
- Not confirmed. Check the site
- Open source
- Yes · Source code
- Language
- English
- Last checked
- Oct 6, 2026 · Online when checked
- Listed
- Oct 5, 2026
Mastodon.py alternatives
Tools and sites you could use instead, ranked by how closely they match.
Fetch missing replies and posts from other Fediverse instances and add them to your Mastodon instance with FediFetcher.
Connect to Mastodon from a Classic Mac OS computer with macstodon, a basic client.
toot provides command-line and text-interface tools for interacting with Mastodon instances.
Interact with Mastodon instances from the command line using tootstream.
Compare different Lemmy instances using this repository’s instance list.
Popular in Fediverse
Well-known listings from the same topic.
Mastodon.py FAQ
How is Mastodon.py installed?
Does Mastodon.py support Python 2?
Tell us and an editor will check it.
Claim the listing and suggest updates yourself. An editor checks every claim first.












