aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/01_general.rst10
-rw-r--r--docs/index.rst33
2 files changed, 30 insertions, 13 deletions
diff --git a/docs/01_general.rst b/docs/01_general.rst
index 556cd63..012a37a 100644
--- a/docs/01_general.rst
+++ b/docs/01_general.rst
@@ -123,6 +123,16 @@ you can also just write
123 123
124and everything will work as intended. 124and everything will work as intended.
125 125
126Snowflake IDs
127~~~~~~~~~~~~~
128Some IDs in Mastodon (such as those for statuses) are Snowflake IDs. These broadly
129correspond to times, with a low resolution, so it is possible to convert a time to
130a Snowflake ID and search for posts between two dates. Mastodon.py will do the
131conversion for you automatically when you pass a `datetime` object as the id.
132
133Note that this functionality will *not* work on anything but Mastodon and forks,
134and that it is somewhat inexact due to the relatively low resolution.
135
126Versioning 136Versioning
127---------- 137----------
128Mastodon.py will check if a certain endpoint is available before doing API 138Mastodon.py will check if a certain endpoint is available before doing API
diff --git a/docs/index.rst b/docs/index.rst
index d5a7e88..a333433 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -3,45 +3,53 @@ Mastodon.py
3.. py:module:: mastodon 3.. py:module:: mastodon
4.. py:class: Mastodon 4.. py:class: Mastodon
5 5
6Usage
7-----
6Register your app! This only needs to be done once. Uncomment the code and substitute in your information: 8Register your app! This only needs to be done once. Uncomment the code and substitute in your information:
7 9
8.. code-block:: python 10.. code-block:: python
9 11
10 from mastodon import Mastodon 12 from mastodon import Mastodon
11 13
12 ''' 14 '''
13 Mastodon.create_app( 15 Mastodon.create_app(
14 'pytooterapp', 16 'pytooterapp',
15 api_base_url = 'https://mastodon.social', 17 api_base_url = 'https://mastodon.social',
16 to_file = 'pytooter_clientcred.secret' 18 to_file = 'pytooter_clientcred.secret'
17 ) 19 )
18 ''' 20 '''
19 21
20Then login. This can be done every time, or you can use the persisted information: 22Then login. This can be done every time, or you can use the persisted information:
21 23
22.. code-block:: python 24.. code-block:: python
23 25
24 from mastodon import Mastodon 26 from mastodon import Mastodon
25 27
26 mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',) 28 mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',)
27 mastodon.log_in('[email protected]', 'incrediblygoodpassword', to_file = 'pytooter_usercred.secret') 29 mastodon.log_in(
30 '[email protected]',
31 'incrediblygoodpassword',
32 to_file = 'pytooter_usercred.secret'
33 )
28 34
29To post, create an actual API instance: 35To post, create an actual API instance:
30 36
31.. code-block:: python 37.. code-block:: python
32 38
33 from mastodon import Mastodon 39 from mastodon import Mastodon
34 40
35 mastodon = Mastodon(access_token = 'pytooter_usercred.secret') 41 mastodon = Mastodon(access_token = 'pytooter_usercred.secret')
36 mastodon.toot('Tooting from Python using #mastodonpy !') 42 mastodon.toot('Tooting from Python using #mastodonpy !')
37 43
44Introduction
45------------
38`Mastodon`_ is an ActivityPub-based Twitter-like federated social 46`Mastodon`_ is an ActivityPub-based Twitter-like federated social
39network node. It has an API that allows you to interact with its 47network node. It has an API that allows you to interact with its
40every aspect. This is a simple Python wrapper for that API, provided 48every aspect. This is a simple Python wrapper for that API, provided
41as a single Python module. 49as a single Python module.
42 50
43Mastodon.py aims to implement the complete public Mastodon API. As 51Mastodon.py aims to implement the complete public Mastodon API. As
44of this time, it is feature complete for Mastodon version 3.5.0. The 52of this time, it is feature complete for Mastodon version 3.5.3. The
45Mastodon compatible API layers of various other pieces of software as well 53Mastodon compatible API layers of various other pieces of software as well
46as forks, while not an official target, should also be basically 54as forks, while not an official target, should also be basically
47compatible, and Mastodon.py does make some allowances for behaviour that isn't 55compatible, and Mastodon.py does make some allowances for behaviour that isn't
@@ -85,4 +93,3 @@ about who helped with which particular feature or fix in the changelog.
85 93
86 14_contributing 94 14_contributing
87 15_everything 95 15_everything
88 \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)