diff options
author | clarkzjw <[email protected]> | 2023-02-22 14:01:16 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-02-23 12:07:26 -0800 |
commit | ae99c2d7237021e2abb20d4b41a24e0b73028519 (patch) | |
tree | 4c4a2a4d954a51148890d5bf589c938f24633f28 /toot.py | |
parent | 75b88bc06d354df64c12497330f124392fa7fc57 (diff) | |
download | swarm2fediverse-ae99c2d7237021e2abb20d4b41a24e0b73028519.tar.gz |
bot: support Mastodon OAuth2 login
test callback
test mastodon callback
test callback
clean customwebhook example
bot: test oauth login
test callback url
test callback
Diffstat (limited to 'toot.py')
-rw-r--r-- | toot.py | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1,12 +1,20 @@ | |||
1 | from mastodon import Mastodon | 1 | from mastodon import Mastodon |
2 | 2 | ||
3 | from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID | 3 | from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID, MASTODON_CLIENT_ID_FILE |
4 | 4 | ||
5 | ''' | 5 | ''' |
6 | https://mastodonpy.readthedocs.io/en/stable/index.html | 6 | https://mastodonpy.readthedocs.io/en/stable/index.html |
7 | ''' | 7 | ''' |
8 | 8 | ||
9 | mastodon_client = Mastodon(client_id=TOOT_CLIENT_ID, | 9 | mastodon_client = Mastodon(client_id=MASTODON_CLIENT_ID_FILE, |
10 | client_secret=TOOT_CLIENT_SECRET, | 10 | api_base_url=TOOT_API_BASE_URL) |
11 | api_base_url=TOOT_API_BASE_URL, | 11 | |
12 | access_token=TOOT_ACCESS_TOKEN) | 12 | url = mastodon_client.auth_request_url(redirect_uris="https://zjw.social/checkinbot/fedi_login_callback", scopes=['write:media', 'write:statuses']) |
13 | print(url) | ||
14 | |||
15 | # mastodon_client.log_in( | ||
16 | # username="[email protected]", | ||
17 | # code='2RnDpj9lMGLWuIeppl-Cghy-iwSXzlJFWU6mQaKYD9o', | ||
18 | # # redirect_uri="urn:ietf:wg:oauth:2.0:oob", | ||
19 | # scopes=['write:media', 'write:statuses'] | ||
20 | # ) | ||