diff options
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 37 |
1 files changed, 17 insertions, 20 deletions
@@ -1,37 +1,35 @@ | |||
1 | Mastodon.py | 1 | Mastodon.py |
2 | =========== | 2 | =========== |
3 | Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API. | 3 | Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API. |
4 | Feature complete for public API as of Mastodon version 3.4.0 and easy to get started with: | 4 | Feature complete for public API as of Mastodon version 3.5.5 and easy to get started with: |
5 | 5 | ||
6 | .. code-block:: python | 6 | .. code-block:: python |
7 | 7 | ||
8 | # Register your app! This only needs to be done once. Uncomment the code and substitute in your information. | ||
9 | |||
10 | from mastodon import Mastodon | 8 | from mastodon import Mastodon |
11 | 9 | ||
10 | # Register your app! This only needs to be done once (per server, or when | ||
11 | # distributing rather than hosting an application, most likely per device and server). | ||
12 | # Uncomment the code and substitute in your information: | ||
13 | |||
12 | ''' | 14 | ''' |
13 | Mastodon.create_app( | 15 | Mastodon.create_app( |
14 | 'pytooterapp', | 16 | 'pytooterapp', |
15 | api_base_url = 'https://mastodon.social', | 17 | api_base_url = 'https://mastodon.social', |
16 | to_file = 'pytooter_clientcred.secret' | 18 | to_file = 'pytooter_clientcred.secret' |
17 | ) | 19 | ) |
18 | ''' | 20 | ''' |
19 | 21 | ||
20 | # Then login. This can be done every time, or use persisted. | 22 | # Then, log in. This can be done every time your application starts (e.g. when writing a |
21 | 23 | # simple bot), or you can use the persisted information: | |
22 | from mastodon import Mastodon | 24 | mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',) |
23 | |||
24 | mastodon = Mastodon(client_id = 'pytooter_clientcred.secret') | ||
25 | mastodon.log_in( | 25 | mastodon.log_in( |
26 | '[email protected]', | 26 | '[email protected]', |
27 | 'incrediblygoodpassword', | 27 | 'incrediblygoodpassword', |
28 | to_file = 'pytooter_usercred.secret' | 28 | to_file = 'pytooter_usercred.secret' |
29 | ) | 29 | ) |
30 | 30 | ||
31 | # To post, create an actual API instance. | 31 | # Note that this won't work when using 2FA - you'll have to use OAuth, in that case. |
32 | 32 | # To post, create an actual API instance: | |
33 | from mastodon import Mastodon | ||
34 | |||
35 | mastodon = Mastodon(access_token = 'pytooter_usercred.secret') | 33 | mastodon = Mastodon(access_token = 'pytooter_usercred.secret') |
36 | mastodon.toot('Tooting from Python using #mastodonpy !') | 34 | mastodon.toot('Tooting from Python using #mastodonpy !') |
37 | 35 | ||
@@ -42,9 +40,8 @@ You can install Mastodon.py via pypi: | |||
42 | # Python 3 | 40 | # Python 3 |
43 | pip3 install Mastodon.py | 41 | pip3 install Mastodon.py |
44 | 42 | ||
45 | Note that Python 2.7 is now no longer officially supported. It will still | 43 | We currently try to support Python 3.7 and above, and try to at least not break Python 3 versions |
46 | work for a while, and we will fix issues as they come up, but we will not | 44 | below that. Python 2 support is no longer a goal. |
47 | be testing specifically for Python 2.7 any longer. | ||
48 | 45 | ||
49 | Full documentation and basic usage examples can be found | 46 | Full documentation and basic usage examples can be found |
50 | at https://mastodonpy.readthedocs.io/en/stable/ | 47 | at https://mastodonpy.readthedocs.io/en/stable/ |