aboutsummaryrefslogtreecommitdiff
blob: 1a05603b9c5bae3b8fe9c6a3bc1b0cf1f75088d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
App registration and user authentication
========================================
.. py:module:: mastodon
.. py:class: Mastodon

Before you can use the Mastodon API, you have to register your
application (which gets you a client key and client secret)
and then log in (which gets you an access token) and out (revoking
the access token you are logged in with). These functions
allow you to do those things. Additionally, it is also possible
to programmatically register a new user.

For convenience, once you have a client id, secret and access token,
you can simply pass them to the constructor of the class, too!

Note that while it is perfectly reasonable to log back in whenever
your app starts, registering a new application on every
startup is not, so don't do that - instead, register an application
once, and then persist your client id and secret. A convenient method
for this is provided by the functions dealing with registering the app,
logging in and the Mastodon classes constructor.

To talk to an instance different from the flagship instance, specify
the api_base_url (usually, just the URL of the instance, i.e.
https://mastodon.social/ for the flagship instance). If no protocol
is specified, Mastodon.py defaults to https.

.. automethod:: Mastodon.create_app
.. automethod:: Mastodon.__init__
.. _log_in():
.. automethod:: Mastodon.log_in
.. _auth_request_url():
.. automethod:: Mastodon.auth_request_url
.. _set_language():
.. automethod:: Mastodon.set_language
.. automethod:: Mastodon.revoke_access_token
.. automethod:: Mastodon.create_account
.. automethod:: Mastodon.email_resend_confirmation
Powered by cgit v1.2.3 (git 2.41.0)