diff options
author | Lorenz Diener <[email protected]> | 2018-11-26 10:50:54 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2018-11-26 10:50:54 +0100 |
commit | e1e003ec762e126338032193ec7a70df659512a4 (patch) | |
tree | a5c058494afdea00590c2565849275281706cba8 /README.rst | |
parent | 191ad84cef0b37e8d8a708812336858d447304c5 (diff) | |
parent | dc4b3ffc03c3724c09862bb114736786a0679032 (diff) | |
download | mastodon.py-e1e003ec762e126338032193ec7a70df659512a4.tar.gz |
Merge pull request #143 from MarkEEaton/master
Revise sample code in README.rst
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,10 +1,11 @@ | |||
1 | Mastodon.py | 1 | Mastodon.py |
2 | =========== | 2 | =========== |
3 | Register your app! This only needs to be done once. Uncomment the code and substitute in your information. | ||
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 | ''' |
9 | Mastodon.create_app( | 10 | Mastodon.create_app( |
10 | 'pytooterapp', | 11 | 'pytooterapp', |
@@ -13,8 +14,12 @@ Mastodon.py | |||
13 | ) | 14 | ) |
14 | ''' | 15 | ''' |
15 | 16 | ||
16 | # Log in - either every time, or use persisted | 17 | Then login. This can be done every time, or use persisted. |
17 | ''' | 18 | |
19 | .. code-block:: python | ||
20 | |||
21 | from mastodon import Mastodon | ||
22 | |||
18 | mastodon = Mastodon( | 23 | mastodon = Mastodon( |
19 | client_id = 'pytooter_clientcred.secret', | 24 | client_id = 'pytooter_clientcred.secret', |
20 | api_base_url = 'https://mastodon.social' | 25 | api_base_url = 'https://mastodon.social' |
@@ -24,9 +29,13 @@ Mastodon.py | |||
24 | 'incrediblygoodpassword', | 29 | 'incrediblygoodpassword', |
25 | to_file = 'pytooter_usercred.secret' | 30 | to_file = 'pytooter_usercred.secret' |
26 | ) | 31 | ) |
27 | ''' | ||
28 | 32 | ||
29 | # Create actual API instance | 33 | To post, create an actual API instance. |
34 | |||
35 | .. code-block:: python | ||
36 | |||
37 | from mastodon import Mastodon | ||
38 | |||
30 | mastodon = Mastodon( | 39 | mastodon = Mastodon( |
31 | access_token = 'pytooter_usercred.secret', | 40 | access_token = 'pytooter_usercred.secret', |
32 | api_base_url = 'https://mastodon.social' | 41 | api_base_url = 'https://mastodon.social' |