1
0
Fork 0
mirror of https://gitlab.com/oloturia/damastodon.git synced 2024-11-16 08:30:46 +01:00
damastodon/createcred.py

34 lines
521 B
Python
Raw Normal View History

2021-10-29 03:11:27 +02:00
#!/usr/bin/python3
from mastodon import Mastodon
from os.path import exists
import sys
try:
API_URL = sys.argv[1]
username = sys.argv[2]
password = sys.argv[3]
except:
print("createcred.py url username password")
if API_URL[:4] != "http":
print("Invalid URL")
quit()
if not (exists("TOKEN")):
Mastodon.create_app(
"dama",
api_base_url = API_URL,
to_file="TOKEN"
)
mastodon = Mastodon(
client_id = 'TOKEN',
api_base_url = API_URL
)
mastodon.log_in(
username,
password,
to_file = "DAMA.SECRET"
)