2022-10-02 20:19:32 +02:00
|
|
|
# MisskeyAPI
|
2022-10-03 12:03:48 +02:00
|
|
|
Python wrapper for Miskkey API (WIP)
|
2022-10-02 20:19:32 +02:00
|
|
|
|
2022-10-02 21:21:03 +02:00
|
|
|
Sample usage:
|
|
|
|
|
|
|
|
```
|
2022-10-03 14:09:39 +02:00
|
|
|
from misskey.misskeyapi import MisskeyAPI
|
2022-10-02 21:21:03 +02:00
|
|
|
|
2022-10-02 21:33:57 +02:00
|
|
|
misskey = MisskeyAPI("https://your.misskey.instance")
|
2022-10-02 21:21:03 +02:00
|
|
|
|
|
|
|
app_secret = misskey.app_create(
|
|
|
|
app_name,
|
|
|
|
description,
|
|
|
|
permission,
|
|
|
|
callbackUrl
|
|
|
|
)
|
|
|
|
|
|
|
|
response = misskey.auth_session_generate(app_secret)
|
|
|
|
|
|
|
|
if response.ok:
|
|
|
|
|
|
|
|
token = response.json()['token']
|
|
|
|
url = response.json()['url']
|
|
|
|
input(f'open this url in your browser: {url} and accept it. Then press enter')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print(response)
|
|
|
|
|
|
|
|
response = misskey.auth_session_userkey(app_secret, token)
|
|
|
|
|
|
|
|
if response.ok:
|
|
|
|
|
|
|
|
token = response.json()['accessToken']
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print(response.text)
|
|
|
|
```
|
|
|
|
|
2022-10-06 19:00:10 +02:00
|
|
|
Store or write down in a safe place this last obtained `token` to further usage with any of the API endpoints that require it (param `i(token)`).
|
|
|
|
|
2022-10-06 19:04:53 +02:00
|
|
|
See [endpoints table](https://git.mastodont.cat/spla/MisskeyAPI/src/branch/main/endpoints/misskey_endpoints.md)
|