diff options
-rw-r--r-- | docs/01_general.rst | 10 | ||||
-rw-r--r-- | docs/index.rst | 33 |
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 | ||
124 | and everything will work as intended. | 124 | and everything will work as intended. |
125 | 125 | ||
126 | Snowflake IDs | ||
127 | ~~~~~~~~~~~~~ | ||
128 | Some IDs in Mastodon (such as those for statuses) are Snowflake IDs. These broadly | ||
129 | correspond to times, with a low resolution, so it is possible to convert a time to | ||
130 | a Snowflake ID and search for posts between two dates. Mastodon.py will do the | ||
131 | conversion for you automatically when you pass a `datetime` object as the id. | ||
132 | |||
133 | Note that this functionality will *not* work on anything but Mastodon and forks, | ||
134 | and that it is somewhat inexact due to the relatively low resolution. | ||
135 | |||
126 | Versioning | 136 | Versioning |
127 | ---------- | 137 | ---------- |
128 | Mastodon.py will check if a certain endpoint is available before doing API | 138 | Mastodon.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 | ||
6 | Usage | ||
7 | ----- | ||
6 | Register your app! This only needs to be done once. Uncomment the code and substitute in your information: | 8 | Register 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 | ||
20 | Then login. This can be done every time, or you can use the persisted information: | 22 | Then 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 | ||
29 | To post, create an actual API instance: | 35 | To 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 | ||
44 | Introduction | ||
45 | ------------ | ||
38 | `Mastodon`_ is an ActivityPub-based Twitter-like federated social | 46 | `Mastodon`_ is an ActivityPub-based Twitter-like federated social |
39 | network node. It has an API that allows you to interact with its | 47 | network node. It has an API that allows you to interact with its |
40 | every aspect. This is a simple Python wrapper for that API, provided | 48 | every aspect. This is a simple Python wrapper for that API, provided |
41 | as a single Python module. | 49 | as a single Python module. |
42 | 50 | ||
43 | Mastodon.py aims to implement the complete public Mastodon API. As | 51 | Mastodon.py aims to implement the complete public Mastodon API. As |
44 | of this time, it is feature complete for Mastodon version 3.5.0. The | 52 | of this time, it is feature complete for Mastodon version 3.5.3. The |
45 | Mastodon compatible API layers of various other pieces of software as well | 53 | Mastodon compatible API layers of various other pieces of software as well |
46 | as forks, while not an official target, should also be basically | 54 | as forks, while not an official target, should also be basically |
47 | compatible, and Mastodon.py does make some allowances for behaviour that isn't | 55 | compatible, 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 | ||