2016-11-24 20:55:54 +01:00
|
|
|
Mastodon.py
|
|
|
|
===========
|
2016-11-24 21:03:18 +01:00
|
|
|
.. code-block:: python
|
2016-11-24 03:07:07 +01:00
|
|
|
|
2017-04-01 15:08:13 +02:00
|
|
|
from mastodon import Mastodon
|
|
|
|
|
|
|
|
# Register app - only once!
|
|
|
|
'''
|
|
|
|
Mastodon.create_app(
|
2017-06-16 01:29:12 +02:00
|
|
|
'pytooterapp',
|
|
|
|
api_base_url = 'https://mastodon.social',
|
|
|
|
to_file = 'pytooter_clientcred.secret'
|
2017-04-01 15:08:13 +02:00
|
|
|
)
|
|
|
|
'''
|
|
|
|
|
|
|
|
# Log in - either every time, or use persisted
|
|
|
|
'''
|
2017-06-16 01:29:12 +02:00
|
|
|
mastodon = Mastodon(
|
|
|
|
client_id = 'pytooter_clientcred.secret',
|
|
|
|
api_base_url = 'https://mastodon.social'
|
|
|
|
)
|
2017-04-01 15:08:13 +02:00
|
|
|
mastodon.log_in(
|
|
|
|
'my_login_email@example.com',
|
2017-06-16 01:29:12 +02:00
|
|
|
'incrediblygoodpassword',
|
|
|
|
to_file = 'pytooter_usercred.secret'
|
2017-04-01 15:08:13 +02:00
|
|
|
)
|
|
|
|
'''
|
|
|
|
|
2017-06-16 01:29:12 +02:00
|
|
|
# Create actual API instance
|
2016-11-24 20:55:54 +01:00
|
|
|
mastodon = Mastodon(
|
2017-06-16 01:29:12 +02:00
|
|
|
client_id = 'pytooter_clientcred.secret',
|
|
|
|
access_token = 'pytooter_usercred.secret',
|
|
|
|
api_base_url = 'https://mastodon.social'
|
2016-11-24 20:55:54 +01:00
|
|
|
)
|
2017-06-16 01:29:12 +02:00
|
|
|
mastodon.toot('Tooting from python using #mastodonpy !')
|
2016-11-24 03:07:07 +01:00
|
|
|
|
2017-04-12 10:21:09 +02:00
|
|
|
Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API.
|
2018-01-29 15:33:20 +01:00
|
|
|
Feature complete for public API as of Mastodon version 2.2.0 and easy to get started with.
|
2016-11-23 23:30:51 +01:00
|
|
|
|
2016-11-24 21:03:18 +01:00
|
|
|
You can install Mastodon.py via pypi:
|
|
|
|
|
|
|
|
.. code-block:: Bash
|
|
|
|
|
|
|
|
# Python 2
|
|
|
|
pip install Mastodon.py
|
|
|
|
|
|
|
|
# Python 3
|
|
|
|
pip3 install Mastodon.py
|
|
|
|
|
2017-06-16 01:29:12 +02:00
|
|
|
Full documentation and basic usage examples can be found
|
2016-11-24 13:21:51 +01:00
|
|
|
at http://mastodonpy.readthedocs.io/en/latest/ .
|
2017-11-29 18:11:03 +01:00
|
|
|
|
2017-12-14 13:42:13 +01:00
|
|
|
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.
|
|
|
|
|
2017-11-29 18:11:03 +01:00
|
|
|
.. image:: https://travis-ci.org/halcy/Mastodon.py.svg?branch=master
|
|
|
|
:target: https://travis-ci.org/halcy/Mastodon.py
|
2017-11-30 16:04:42 +01:00
|
|
|
.. image:: https://codecov.io/gh/halcy/Mastodon.py/branch/master/graph/badge.svg
|
2017-12-14 13:42:13 +01:00
|
|
|
:target: https://codecov.io/gh/halcy/Mastodon.py
|
2017-11-30 16:04:42 +01:00
|
|
|
|
|
|
|
|