mirror of
https://gitlab.com/oloturia/damastodon.git
synced 2024-11-16 00:20:46 +01:00
33 lines
521 B
Python
Executable file
33 lines
521 B
Python
Executable file
#!/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"
|
|
)
|