Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API.
 
 
Go to file
Lorenz Diener b16b811ef5
Merge pull request #394 from aitorres/aitorres/wrap-unpacking-statement
[minor] Remove "unpacking" + commented `print` statement
2025-02-27 12:41:41 +02:00
.circleci remove 3.14, not valid yet 2025-02-14 00:25:24 +02:00
.githooks Add many, many tests, and fix bugs found while adding them. also serialization. 2025-02-14 20:08:00 +02:00
docs [minor] remove commented print statements 2025-02-26 13:49:48 -08:00
mastodon [minor] remove commented print statements 2025-02-26 13:49:48 -08:00
srcgen add new entity tests 2025-02-15 22:05:25 +02:00
tests add new entity tests 2025-02-15 22:05:25 +02:00
.gitignore
.readthedocs.yaml different variant 2024-02-11 23:33:50 +02:00
CHANGELOG.rst release prep 2025-02-15 22:48:59 +02:00
CITATION.cff add citation file 2024-02-11 22:43:46 +02:00
DEVELOPMENT.md Add many, many tests, and fix bugs found while adding them. also serialization. 2025-02-14 20:08:00 +02:00
LICENSE
MANIFEST.in
README.rst release prep 2025-02-15 22:48:59 +02:00
TODO.md add v2 filters 2025-02-15 21:54:08 +02:00
pyproject.toml release prep 2025-02-15 22:48:59 +02:00
setup.py setup.py → pyproject.toml 2023-04-24 18:45:53 +02:00
tox.ini move webpush and blurhash deps out of test deps 2023-04-25 14:18:36 +02:00

README.rst

Mastodon.py
===========
Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API.
Feature complete for public API as of Mastodon version 4.3.0 and easy to get started with:

.. code-block:: python

    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:

.. code-block:: Bash

   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

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.

.. image:: https://circleci.com/gh/halcy/Mastodon.py.svg?style=svg
    :target: https://app.circleci.com/pipelines/github/halcy/Mastodon.py
.. image:: https://codecov.io/gh/halcy/Mastodon.py/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/halcy/Mastodon.py