-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
This can be done using the command "config show"
def token_expiry(remote_name):
command = "config show " + remote_name
stdout, _ = utils.run_rclone_cmd(command)
process_out = stdout.split('\n')
for str_out in process_out:
if str_out.find("token = ")==0:
token_str = str_out.replace("token = ","")
try:
token_dict = json.loads(token_str)
expiry_str = token_dict['expiry']
expiry_str = expiry_str[:26] + expiry_str[27:] # уберем 1 милисекунду
expiry_date = datetime.datetime.fromisoformat(expiry_str)
expiry_date = expiry_date.astimezone().replace(tzinfo=None)
return expiry_date
except:
return None
return None
Metadata
Metadata
Assignees
Labels
No labels