Update README.md

This commit is contained in:
spla 2022-07-24 21:54:08 +02:00
pare 4fced75d90
commit 4d19b21940

Veure arxiu

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