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 3.5.5 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 (e.g. when writing a
# simple bot), or you can use the persisted information:
mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',)
mastodon.log_in(
'my_login_email@example.com',
'incrediblygoodpassword',
to_file = 'pytooter_usercred.secret'
)
# Note that this won't work when using 2FA - you'll have to use OAuth, in that case.
# 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:
# Python 3
pip3 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
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
File details
Details for the file Mastodon.py-1.8.1.tar.gz
.
File metadata
- Download URL: Mastodon.py-1.8.1.tar.gz
- Upload date:
- Size: 8.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a64cb94abadd6add73e4b8eafdb5c466048fa5f638284fd2189034104d4687e |
|
MD5 | 3961141d4c3836dd7f9a27b3ddb6aa63 |
|
BLAKE2b-256 | cc7a240ac474f69a58a5dda0513557fe9c2ada279f7d5d836b93d5f6e05a9aa7 |
File details
Details for the file Mastodon.py-1.8.1-py2.py3-none-any.whl
.
File metadata
- Download URL: Mastodon.py-1.8.1-py2.py3-none-any.whl
- Upload date:
- Size: 65.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22bc7e060518ef2eaa69d911cde6e4baf56bed5ea0dd407392c49051a7ac526a |
|
MD5 | b39c3d104f544cf8fd1711f751efc856 |
|
BLAKE2b-256 | a052a97c498fbb1fd73cee5fcd3f1979efac39784e3514c4014459f174e3f22a |