aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'docs/index.rst')
-rw-r--r--docs/index.rst21
1 files changed, 15 insertions, 6 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 0cff37e..808e563 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -2,12 +2,13 @@ Mastodon.py
2=========== 2===========
3.. py:module:: mastodon 3.. py:module:: mastodon
4.. py:class: Mastodon 4.. py:class: Mastodon
5
6Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
5 7
6.. code-block:: python 8.. code-block:: python
7 9
8 from mastodon import Mastodon 10 from mastodon import Mastodon
9 11
10 # Register app - only once!
11 ''' 12 '''
12 Mastodon.create_app( 13 Mastodon.create_app(
13 'pytooterapp', 14 'pytooterapp',
@@ -16,8 +17,12 @@ Mastodon.py
16 ) 17 )
17 ''' 18 '''
18 19
19 # Log in - either every time, or use persisted 20Then login. This can be done every time, or use persisted.
20 ''' 21
22.. code-block:: python
23
24 from mastodon import Mastodon
25
21 mastodon = Mastodon( 26 mastodon = Mastodon(
22 client_id = 'pytooter_clientcred.secret', 27 client_id = 'pytooter_clientcred.secret',
23 api_base_url = 'https://mastodon.social' 28 api_base_url = 'https://mastodon.social'
@@ -27,14 +32,18 @@ Mastodon.py
27 'incrediblygoodpassword', 32 'incrediblygoodpassword',
28 to_file = 'pytooter_usercred.secret' 33 to_file = 'pytooter_usercred.secret'
29 ) 34 )
30 '''
31 35
32 # Create actual API instance 36To post, create an actual API instance.
37
38.. code-block:: python
39
40 from mastodon import Mastodon
41
33 mastodon = Mastodon( 42 mastodon = Mastodon(
34 access_token = 'pytooter_usercred.secret', 43 access_token = 'pytooter_usercred.secret',
35 api_base_url = 'https://mastodon.social' 44 api_base_url = 'https://mastodon.social'
36 ) 45 )
37 mastodon.toot('Tooting from python using #mastodonpy !') 46 mastodon.toot('Tooting from python using #mastodonpy !')
38 47
39`Mastodon`_ is an ActivityPub and OStatus based twitter-like federated social 48`Mastodon`_ is an ActivityPub and OStatus based twitter-like federated social
40network node. It has an API that allows you to interact with its 49network node. It has an API that allows you to interact with its
Powered by cgit v1.2.3 (git 2.41.0)