mirror of
https://github.com/nova-r/fediplug.git
synced 2025-03-10 07:39:00 +01:00
No need to construct the client
twice when logging in
This commit is contained in:
parent
96096d7b00
commit
22031dbcb5
1 changed files with 2 additions and 3 deletions
|
@ -73,8 +73,7 @@ def register(api_base_url):
|
||||||
Mastodon.create_app('fediplay', api_base_url=api_base_url, to_file='clientcred.secret')
|
Mastodon.create_app('fediplay', api_base_url=api_base_url, to_file='clientcred.secret')
|
||||||
umask(old_umask)
|
umask(old_umask)
|
||||||
|
|
||||||
def login(api_base_url, grant_code):
|
def login(client, grant_code):
|
||||||
client = Mastodon(client_id='clientcred.secret', api_base_url=api_base_url)
|
|
||||||
old_umask = umask(0o77)
|
old_umask = umask(0o77)
|
||||||
client.log_in(code=grant_code, to_file='usercred.secret')
|
client.log_in(code=grant_code, to_file='usercred.secret')
|
||||||
umask(old_umask)
|
umask(old_umask)
|
||||||
|
@ -128,7 +127,7 @@ def main():
|
||||||
print("Open this page in your browser and follow the instructions to get the code you need, then paste it here")
|
print("Open this page in your browser and follow the instructions to get the code you need, then paste it here")
|
||||||
print(client.auth_request_url())
|
print(client.auth_request_url())
|
||||||
grant_code = input('Code? ')
|
grant_code = input('Code? ')
|
||||||
login(api_base_url, grant_code)
|
login(client, grant_code)
|
||||||
|
|
||||||
stream(api_base_url)
|
stream(api_base_url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue