diff options
-rw-r--r-- | README.rst | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1,20 +1,23 @@ | |||
1 | Mastodon.py | 1 | Mastodon.py |
2 | =========== | 2 | =========== |
3 | Register your app! This only needs to be done once. | ||
4 | |||
3 | .. code-block:: python | 5 | .. code-block:: python |
4 | 6 | ||
5 | from mastodon import Mastodon | 7 | from mastodon import Mastodon |
6 | 8 | ||
7 | # Register app - only once! | ||
8 | ''' | ||
9 | Mastodon.create_app( | 9 | Mastodon.create_app( |
10 | 'pytooterapp', | 10 | 'pytooterapp', |
11 | api_base_url = 'https://mastodon.social', | 11 | api_base_url = 'https://mastodon.social', |
12 | to_file = 'pytooter_clientcred.secret' | 12 | to_file = 'pytooter_clientcred.secret' |
13 | ) | 13 | ) |
14 | ''' | ||
15 | 14 | ||
16 | # Log in - either every time, or use persisted | 15 | Then login. This can be done every time, or use persisted. |
17 | ''' | 16 | |
17 | .. code-block:: python | ||
18 | |||
19 | from mastodon import Mastodon | ||
20 | |||
18 | mastodon = Mastodon( | 21 | mastodon = Mastodon( |
19 | client_id = 'pytooter_clientcred.secret', | 22 | client_id = 'pytooter_clientcred.secret', |
20 | api_base_url = 'https://mastodon.social' | 23 | api_base_url = 'https://mastodon.social' |
@@ -24,9 +27,13 @@ Mastodon.py | |||
24 | 'incrediblygoodpassword', | 27 | 'incrediblygoodpassword', |
25 | to_file = 'pytooter_usercred.secret' | 28 | to_file = 'pytooter_usercred.secret' |
26 | ) | 29 | ) |
27 | ''' | ||
28 | 30 | ||
29 | # Create actual API instance | 31 | To post, create an actual API instance. |
32 | |||
33 | .. code-block:: python | ||
34 | |||
35 | from mastodon import Mastodon | ||
36 | |||
30 | mastodon = Mastodon( | 37 | mastodon = Mastodon( |
31 | access_token = 'pytooter_usercred.secret', | 38 | access_token = 'pytooter_usercred.secret', |
32 | api_base_url = 'https://mastodon.social' | 39 | api_base_url = 'https://mastodon.social' |