diff options
-rw-r--r-- | README.rst | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -2,8 +2,29 @@ Mastodon.py | |||
2 | =========== | 2 | =========== |
3 | .. code-block:: python | 3 | .. code-block:: python |
4 | 4 | ||
5 | from mastodon import Mastodon | ||
6 | |||
7 | # Register app - only once! | ||
8 | ''' | ||
9 | Mastodon.create_app( | ||
10 | 'pytooterapp', | ||
11 | to_file = 'pytooter_clientcred.txt' | ||
12 | ) | ||
13 | ''' | ||
14 | |||
15 | # Log in - either every time, or use persisted | ||
16 | ''' | ||
17 | mastodon = Mastodon(client_id = 'pytooter_clientcred.txt') | ||
18 | mastodon.log_in( | ||
19 | '[email protected]', | ||
20 | 'incrediblygoodpassword', | ||
21 | to_file = 'pytooter_usercred.txt' | ||
22 | ) | ||
23 | ''' | ||
24 | |||
25 | # Create actual instance | ||
5 | mastodon = Mastodon( | 26 | mastodon = Mastodon( |
6 | client_id = 'pytooter_clientcred.txt', | 27 | client_id = 'pytooter_clientcred.txt', |
7 | access_token = 'pytooter_usercred.txt' | 28 | access_token = 'pytooter_usercred.txt' |
8 | ) | 29 | ) |
9 | mastodon.toot('Tooting from python!') | 30 | mastodon.toot('Tooting from python!') |