diff options
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 80 |
1 files changed, 38 insertions, 42 deletions
@@ -1,49 +1,45 @@ | |||
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. | 3 | Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API. |
4 | 4 | Feature complete for public API as of Mastodon version 2.8.0 and easy to get started with: | |
5 | .. code-block:: python | ||
6 | |||
7 | from mastodon import Mastodon | ||
8 | |||
9 | ''' | ||
10 | Mastodon.create_app( | ||
11 | 'pytooterapp', | ||
12 | api_base_url = 'https://mastodon.social', | ||
13 | to_file = 'pytooter_clientcred.secret' | ||
14 | ) | ||
15 | ''' | ||
16 | |||
17 | Then login. This can be done every time, or use persisted. | ||
18 | |||
19 | .. code-block:: python | ||
20 | |||
21 | from mastodon import Mastodon | ||
22 | |||
23 | mastodon = Mastodon( | ||
24 | client_id = 'pytooter_clientcred.secret', | ||
25 | api_base_url = 'https://mastodon.social' | ||
26 | ) | ||
27 | mastodon.log_in( | ||
28 | '[email protected]', | ||
29 | 'incrediblygoodpassword', | ||
30 | to_file = 'pytooter_usercred.secret' | ||
31 | ) | ||
32 | |||
33 | To post, create an actual API instance. | ||
34 | 5 | ||
35 | .. code-block:: python | 6 | .. code-block:: python |
36 | 7 | ||
37 | from mastodon import Mastodon | 8 | #Register your app! This only needs to be done once. Uncomment the code and substitute in your information. |
38 | 9 | ||
39 | mastodon = Mastodon( | 10 | from mastodon import Mastodon |
40 | access_token = 'pytooter_usercred.secret', | 11 | |
41 | api_base_url = 'https://mastodon.social' | 12 | ''' |
42 | ) | 13 | Mastodon.create_app( |
43 | mastodon.toot('Tooting from python using #mastodonpy !') | 14 | 'pytooterapp', |
44 | 15 | api_base_url = 'https://mastodon.social', | |
45 | Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API. | 16 | to_file = 'pytooter_clientcred.secret' |
46 | Feature complete for public API as of Mastodon version 2.4.3 and easy to get started with. | 17 | ) |
18 | ''' | ||
19 | |||
20 | # Then login. This can be done every time, or use persisted. | ||
21 | |||
22 | from mastodon import Mastodon | ||
23 | |||
24 | mastodon = Mastodon( | ||
25 | client_id = 'pytooter_clientcred.secret', | ||
26 | api_base_url = 'https://mastodon.social' | ||
27 | ) | ||
28 | mastodon.log_in( | ||
29 | '[email protected]', | ||
30 | 'incrediblygoodpassword', | ||
31 | to_file = 'pytooter_usercred.secret' | ||
32 | ) | ||
33 | |||
34 | # To post, create an actual API instance. | ||
35 | |||
36 | from mastodon import Mastodon | ||
37 | |||
38 | mastodon = Mastodon( | ||
39 | access_token = 'pytooter_usercred.secret', | ||
40 | api_base_url = 'https://mastodon.social' | ||
41 | ) | ||
42 | mastodon.toot('Tooting from python using #mastodonpy !') | ||
47 | 43 | ||
48 | You can install Mastodon.py via pypi: | 44 | You can install Mastodon.py via pypi: |
49 | 45 | ||
@@ -56,7 +52,7 @@ You can install Mastodon.py via pypi: | |||
56 | pip3 install Mastodon.py | 52 | pip3 install Mastodon.py |
57 | 53 | ||
58 | Full documentation and basic usage examples can be found | 54 | Full documentation and basic usage examples can be found |
59 | at http://mastodonpy.readthedocs.io/en/latest/ . | 55 | at http://mastodonpy.readthedocs.io/en/stable/ . |
60 | 56 | ||
61 | Acknowledgements | 57 | Acknowledgements |
62 | ---------------- | 58 | ---------------- |