From af1cc6e9f848c3fb04c89bc30da1fa82b44bbc7d Mon Sep 17 00:00:00 2001 From: sigma67 Date: Sat, 15 Apr 2023 10:50:29 +0200 Subject: [PATCH] oauth: move input() out of get_code (#378) --- ytmusicapi/auth/oauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ytmusicapi/auth/oauth.py b/ytmusicapi/auth/oauth.py index c866a13..3a657e3 100644 --- a/ytmusicapi/auth/oauth.py +++ b/ytmusicapi/auth/oauth.py @@ -23,8 +23,6 @@ class YTMusicOAuth: def get_code(self) -> Dict: code_response = self._send_request(OAUTH_CODE_URL, data={"scope": OAUTH_SCOPE}) response_json = code_response.json() - url = f"{response_json['verification_url']}?user_code={response_json['user_code']}" - input(f"Go to {url}, finish the login flow and press Enter when done, Ctrl-C to abort") return response_json def get_token_from_code(self, device_code: str) -> Dict: @@ -54,6 +52,8 @@ class YTMusicOAuth: def setup(self, filepath: Optional[str] = None) -> Dict: code = self.get_code() + url = f"{code['verification_url']}?user_code={code['user_code']}" + input(f"Go to {url}, finish the login flow and press Enter when done, Ctrl-C to abort") token = self.get_token_from_code(code["device_code"]) if filepath: self.dump_token(token, filepath)