always open browser if login is called and device_code is availible, and print url to output in case webbrowser.open fails

This commit is contained in:
2025-12-12 23:43:03 -08:00
parent 1ce6dc2de1
commit a793c96532
+5 -1
View File
@@ -394,7 +394,11 @@ def login(*args):
global device_code global device_code
if device_code==None: if device_code==None:
print('astrolobot is still starting, please wait',sys.stderr) print('astrolobot is still starting, please wait',sys.stderr)
webbrowser.open('https://www.twitch.tv/activate?public=true&device-code='+device_code) else:
login_url='https://www.twitch.tv/activate?public=true&device-code='+device_code
print("if your browser doesn't automatically open, go to the following url:")
print(login_url)
webbrowser.open(login_url)
def save_tokens(access_token,refresh_token): def save_tokens(access_token,refresh_token):
with open(script_path()+'tokens.json','w') as file: with open(script_path()+'tokens.json','w') as file: