Akkoma.py/README.md

44 líneas
1.1 KiB
Markdown

2022-07-24 21:14:42 +02:00
# Akkoma.py
2022-07-24 21:18:19 +02:00
Python wrapper for the Akkoma (https://akkoma.dev/AkkomaGang/akkoma) API.
2022-07-24 21:14:42 +02:00
# Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
from akkoma import Akkoma
'''
2022-07-24 21:54:08 +02:00
client_id, client_secret = Akkoma.create_app(
'app_name',
to_file="app_clientcred.txt",
api_base_url = 'https://yourakkoma.instance'
)
2022-07-24 21:14:42 +02:00
'''
# Then login. This can be done every time, or use persisted.
from akkoma import Akkoma
2022-07-24 21:54:08 +02:00
akkoma = Akkoma(client_id = "app_clientcred.txt", api_base_url = 'https://yourakkoma.instance')
grant_type = 'password'
2022-07-24 21:14:42 +02:00
akkoma.log_in(
2022-07-24 21:54:08 +02:00
client_id,
client_secret,
grant_type,
'user',
'password',
to_file = "app_usercred.txt"
)
2022-07-24 21:14:42 +02:00
# To post, create an actual API instance.
from akkoma import Akkoma
akkoma = Akkoma(
2022-07-24 21:54:08 +02:00
access_token = 'app_usercred.txt',
api_base_url = 'https://yourakkoma.instance'
2022-07-24 21:14:42 +02:00
)
2022-07-24 21:54:08 +02:00
akkoma.status_post('Posting from python using Akkoma.py !')
2022-07-24 21:14:42 +02:00