use access-token once retrived with login/pass

This commit is contained in:
cquest 2023-11-01 19:51:59 +01:00
parent bea70c722c
commit 16212f800a

View File

@ -100,17 +100,21 @@ if not os.path.isfile(instance+'.secret'):
sys.exit(1) sys.exit(1)
try: try:
mastodon_api = Mastodon(access_token=mastodon+".secret")
except:
try:
mastodon_api = Mastodon( mastodon_api = Mastodon(
client_id=instance+'.secret', client_id=instance+'.secret',
api_base_url='https://'+instance api_base_url='https://'+instance
) )
print('login')
mastodon_api.log_in( mastodon_api.log_in(
username=mastodon, username=mastodon,
password=passwd, password=passwd,
scopes=['read', 'write'], scopes=['read', 'write'],
to_file=mastodon+".secret" to_file=mastodon+".secret"
) )
except: except:
print("ERROR: First Login Failed!") print("ERROR: First Login Failed!")
sys.exit(1) sys.exit(1)