From 1704965f6dfa5e0df0ee7729943e8dd2a88085ce Mon Sep 17 00:00:00 2001 From: halcy Date: Tue, 29 Nov 2022 01:00:59 +0200 Subject: Fix some nits --- docs/01_general.rst | 10 ++++++++++ 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 and everything will work as intended. +Snowflake IDs +~~~~~~~~~~~~~ +Some IDs in Mastodon (such as those for statuses) are Snowflake IDs. These broadly +correspond to times, with a low resolution, so it is possible to convert a time to +a Snowflake ID and search for posts between two dates. Mastodon.py will do the +conversion for you automatically when you pass a `datetime` object as the id. + +Note that this functionality will *not* work on anything but Mastodon and forks, +and that it is somewhat inexact due to the relatively low resolution. + Versioning ---------- 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 .. py:module:: mastodon .. py:class: Mastodon +Usage +----- Register your app! This only needs to be done once. Uncomment the code and substitute in your information: .. code-block:: python - from mastodon import Mastodon + from mastodon import Mastodon - ''' - Mastodon.create_app( + ''' + Mastodon.create_app( 'pytooterapp', api_base_url = 'https://mastodon.social', to_file = 'pytooter_clientcred.secret' - ) - ''' + ) + ''' Then login. This can be done every time, or you can use the persisted information: .. code-block:: python - from mastodon import Mastodon + from mastodon import Mastodon - mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',) - mastodon.log_in('my_login_email@example.com', 'incrediblygoodpassword', to_file = 'pytooter_usercred.secret') + mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',) + mastodon.log_in( + 'my_login_email@example.com', + 'incrediblygoodpassword', + to_file = 'pytooter_usercred.secret' + ) To post, create an actual API instance: .. code-block:: python - from mastodon import Mastodon + from mastodon import Mastodon - mastodon = Mastodon(access_token = 'pytooter_usercred.secret') - mastodon.toot('Tooting from Python using #mastodonpy !') + mastodon = Mastodon(access_token = 'pytooter_usercred.secret') + mastodon.toot('Tooting from Python using #mastodonpy !') +Introduction +------------ `Mastodon`_ is an ActivityPub-based Twitter-like federated social network node. It has an API that allows you to interact with its every aspect. This is a simple Python wrapper for that API, provided as a single Python module. Mastodon.py aims to implement the complete public Mastodon API. As -of this time, it is feature complete for Mastodon version 3.5.0. The +of this time, it is feature complete for Mastodon version 3.5.3. The Mastodon compatible API layers of various other pieces of software as well as forks, while not an official target, should also be basically 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. 14_contributing 15_everything - \ No newline at end of file -- cgit v1.2.3