kopia lustrzana https://github.com/halcy/Mastodon.py
Fix some nits
rodzic
43c7d7ceb8
commit
1704965f6d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
Ładowanie…
Reference in New Issue