|
|
|
@ -6,35 +6,38 @@ Python wrapper for the Akkoma (https://akkoma.dev/AkkomaGang/akkoma) API.
|
|
|
|
|
from akkoma import Akkoma
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
Akkoma.create_app(
|
|
|
|
|
'pytooterapp',
|
|
|
|
|
api_base_url = 'https://yourakkomainstance.social',
|
|
|
|
|
to_file = 'pytooter_clientcred.secret'
|
|
|
|
|
)
|
|
|
|
|
client_id, client_secret = Akkoma.create_app(
|
|
|
|
|
'app_name',
|
|
|
|
|
to_file="app_clientcred.txt",
|
|
|
|
|
api_base_url = 'https://yourakkoma.instance'
|
|
|
|
|
)
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
# Then login. This can be done every time, or use persisted.
|
|
|
|
|
|
|
|
|
|
from akkoma import Akkoma
|
|
|
|
|
|
|
|
|
|
akkoma = Akkoma(
|
|
|
|
|
client_id = 'pytooter_clientcred.secret',
|
|
|
|
|
api_base_url = 'https://yourakkomainstance.social'
|
|
|
|
|
)
|
|
|
|
|
akkoma = Akkoma(client_id = "app_clientcred.txt", api_base_url = 'https://yourakkoma.instance')
|
|
|
|
|
|
|
|
|
|
grant_type = 'password'
|
|
|
|
|
|
|
|
|
|
akkoma.log_in(
|
|
|
|
|
'my_login_email@example.com',
|
|
|
|
|
'incrediblygoodpassword',
|
|
|
|
|
to_file = 'pytooter_usercred.secret'
|
|
|
|
|
)
|
|
|
|
|
client_id,
|
|
|
|
|
client_secret,
|
|
|
|
|
grant_type,
|
|
|
|
|
'user',
|
|
|
|
|
'password',
|
|
|
|
|
to_file = "app_usercred.txt"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# To post, create an actual API instance.
|
|
|
|
|
|
|
|
|
|
from akkoma import Akkoma
|
|
|
|
|
|
|
|
|
|
akkoma = Akkoma(
|
|
|
|
|
access_token = 'pytooter_usercred.secret',
|
|
|
|
|
api_base_url = 'https://yourakkomainstance.social'
|
|
|
|
|
access_token = 'app_usercred.txt',
|
|
|
|
|
api_base_url = 'https://yourakkoma.instance'
|
|
|
|
|
)
|
|
|
|
|
akkoma.status_post('Tooting from python using #akkomapy !')
|
|
|
|
|
akkoma.status_post('Posting from python using Akkoma.py !')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|