From 22031dbcb54ae0ba814ad575b39c5baac3509e75 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Fri, 16 Feb 2018 23:36:54 -0500 Subject: [PATCH] No need to construct the `client` twice when logging in --- fediplay.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fediplay.py b/fediplay.py index c9eefa4..a2c8df8 100644 --- a/fediplay.py +++ b/fediplay.py @@ -73,8 +73,7 @@ def register(api_base_url): Mastodon.create_app('fediplay', api_base_url=api_base_url, to_file='clientcred.secret') umask(old_umask) -def login(api_base_url, grant_code): - client = Mastodon(client_id='clientcred.secret', api_base_url=api_base_url) +def login(client, grant_code): old_umask = umask(0o77) client.log_in(code=grant_code, to_file='usercred.secret') 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(client.auth_request_url()) grant_code = input('Code? ') - login(api_base_url, grant_code) + login(client, grant_code) stream(api_base_url)