Python wrapper for the Mastodon API
Project description
Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API. Feature complete for public API as of Mastodon version 4.4.3 and easy to get started with:
from mastodon import Mastodon
# Register your app! This only needs to be done once (per server, or when
# distributing rather than hosting an application, most likely per device and server).
# Uncomment the code and substitute in your information:
'''
Mastodon.create_app(
'pytooterapp',
api_base_url = 'https://mastodon.social',
to_file = 'pytooter_clientcred.secret'
)
'''
# Then, log in. This can be done every time your application starts, or you can use the persisted information:
mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',)
print(mastodon.auth_request_url())
# open the URL in the browser and paste the code you get
mastodon.log_in(
code=input("Enter the OAuth authorization code: "),
to_file="pytooter_usercred.secret"
)
# To post, create an actual API instance:
mastodon = Mastodon(access_token = 'pytooter_usercred.secret')
mastodon.toot('Tooting from Python using #mastodonpy !')
You can install Mastodon.py via pypi:
pip install Mastodon.py
We currently try to support Python 3.7 and above, and try to at least not break Python 3 versions below that. Python 2 support is no longer a goal.
Full documentation and basic usage examples can be found at https://mastodonpy.readthedocs.io/en/stable/ . Some more extensive examples can be found at https://github.com/halcy/MastodonpyExamples
If you have any questions about using the library or think you have found a bug, please feel free to open an issue, a github discussion thread, or to just directly contact @halcy@icosahedron.website on the Fediverse or .halcy on Discord - we’ll try to respond as quickly as possible.
Acknowledgements
Mastodon.py contains work by a large amount of contributors, many of which have put significant work into making it a better library. You can find some information about who helped with which particular feature or fix in the changelog.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mastodon_py-2.1.4.tar.gz.
File metadata
- Download URL: mastodon_py-2.1.4.tar.gz
- Upload date:
- Size: 11.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6602e9ca4db37c70b5adae5964d02e9a529f6cc8473947a314261008add208a5
|
|
| MD5 |
506daecf94c4adc872c135b84f049882
|
|
| BLAKE2b-256 |
88ec1eccba4dda197e6993dd1b8a4fa5728f8ed64d3ba54d61ebfe2420a20f4e
|
Provenance
The following attestation bundles were made for mastodon_py-2.1.4.tar.gz:
Publisher:
publish.yml on halcy/Mastodon.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mastodon_py-2.1.4.tar.gz -
Subject digest:
6602e9ca4db37c70b5adae5964d02e9a529f6cc8473947a314261008add208a5 - Sigstore transparency entry: 550313019
- Sigstore integration time:
-
Permalink:
halcy/Mastodon.py@43f99bb28d9342d099574623bd49778824beb777 -
Branch / Tag:
refs/tags/v2.1.4 - Owner: https://github.com/halcy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43f99bb28d9342d099574623bd49778824beb777 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mastodon_py-2.1.4-py3-none-any.whl.
File metadata
- Download URL: mastodon_py-2.1.4-py3-none-any.whl
- Upload date:
- Size: 123.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447ce341cf9a67e70789abf6a2c1a54b52cd2cd021818ccb32c52f34804c7896
|
|
| MD5 |
b75b3edbdf4f268894b3eee030283053
|
|
| BLAKE2b-256 |
02eb23afadb9a0aee04a52adfc010384da267b42b66be6cbb3ed2d3c3edc20f4
|
Provenance
The following attestation bundles were made for mastodon_py-2.1.4-py3-none-any.whl:
Publisher:
publish.yml on halcy/Mastodon.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mastodon_py-2.1.4-py3-none-any.whl -
Subject digest:
447ce341cf9a67e70789abf6a2c1a54b52cd2cd021818ccb32c52f34804c7896 - Sigstore transparency entry: 550313050
- Sigstore integration time:
-
Permalink:
halcy/Mastodon.py@43f99bb28d9342d099574623bd49778824beb777 -
Branch / Tag:
refs/tags/v2.1.4 - Owner: https://github.com/halcy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@43f99bb28d9342d099574623bd49778824beb777 -
Trigger Event:
push
-
Statement type: