Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-10-13 09:22:13 +02:00
parent 0ac2524d3e
commit 23adb50f3a

View File

@ -71,13 +71,6 @@ def refresh():
try:
# Try to load saved client credentials
gauth.LoadCredentialsFile("/root/credentials.json")
except pydrive2.auth.InvalidCredentialsError:
print(gauth.GetAuthUrl())
user_input = input("Please copy this URL into a browser, "
"complete the verification and then copy/paste the code from addressbar.\n\n"
"Code: ")
gauth.Auth(user_input)
if gauth.access_token_expired:
if gauth.credentials is not None:
try:
@ -95,6 +88,13 @@ def refresh():
"complete the verification and then copy/paste the code from addressbar.\n\n"
"Code: ")
gauth.Auth(user_input)
except pydrive2.auth.InvalidCredentialsError:
print(gauth.GetAuthUrl())
user_input = input("Please copy this URL into a browser, "
"complete the verification and then copy/paste the code from addressbar.\n\n"
"Code: ")
gauth.Auth(user_input)
gauth.Authorize()
print("No refresh is required.")
return 0