提交 5143b778 编写于 作者: H Hou Tianze

Help now doesn't require you to auth; Fix auth/refresh_token seconds display

上级 3f63722a
......@@ -960,6 +960,9 @@ Possible fixes:
def __server_auth_act(self, r, args):
return self.__store_json(r)
def __repr_timeout(self):
return self.__timeout if self.__timeout else 'infinite'
def __server_auth(self):
params = {
'client_id' : self.__apikey,
......@@ -971,7 +974,7 @@ Possible fixes:
'\nPaste the Authorization Code here within 10 minutes.'
auth_code = ask(msg).strip()
self.pd("auth_code: {}".format(auth_code))
pr('Authorizing, please be patient, it may take upto {} seconds...'.format(self.__timeout))
pr('Authorizing, please be patient, it may take upto {} seconds...'.format(self.__repr_timeout()))
pars = {
'code' : auth_code,
......@@ -1050,7 +1053,7 @@ Possible fixes:
def __refresh_token(self):
if self.__use_server_auth:
pr('Refreshing, please be patient, it may take upto {} seconds...'.format(self.__timeout))
pr('Refreshing, please be patient, it may take upto {} seconds...'.format(self.__repr_timeout()))
pars = {
'bypy_version' : const.__version__,
......@@ -1103,7 +1106,8 @@ Possible fixes:
pr('Used: ' + human_size(j['used']))
return const.ENoError
def help(self, command): # this comes first to make it easy to spot
@staticmethod
def help(command): # this comes first to make it easy to spot
''' Usage: help <command> - provide some information for the command '''
for i, v in ByPy.__dict__.items():
if callable(v) and v.__doc__ and v.__name__ == command :
......@@ -3614,6 +3618,9 @@ def main(argv=None): # IGNORE:C0111
(len(args.command) == 1 and args.command[0].lower() == 'help'):
parser.print_help()
return const.EArgument
elif len(args.command) == 2 and args.command[0].lower() == 'help':
ByPy.help(args.command[1])
return const.EArgument
elif args.command[0] in ByPy.__dict__: # dir(ByPy), dir(by)
#timeout = args.timeout or None
......
{
"access_token": "21.b6bfc014e7094b25486ca333da9dda72.2592000.1518896562.2844184044-1572671",
"access_token": "21.d9048d34e50919be264f38b02f5cd4ba.2592000.1522859613.2844184044-1572671",
"expires_in": 2592000,
"refresh_token": "22.7ffec5b2e7b245f60498f40fd70b9b90.315360000.1831664562.2844184044-1572671",
"refresh_token": "22.f7ae7645a659c3b90f71fee3f68c06a4.315360000.1835627613.2844184044-1572671",
"scope": "basic netdisk",
"session_key": "9mnRJqcd9Jwmx+PQS0eda5eXNqKRuViH7c4xV37XaXbcPUDD5xkpL3E2luXB5tmZAUW3W3hI3NM09Fnl7hmyjJugfQGqNlbJ1g==",
"session_secret": "674217383ef19a2d8b1ce706c0e152c0"
"session_key": "9mnRIBJFGBQTAKDFLj5G7V/jzVgoxWp0v5aXSBsAP8OS11xook9Y6FTVBif8ymyv9GJeJC6wEkNWemuAOadxJoJHp/iDQQg13g==",
"session_secret": "60df8b9c6de01c6e7d98154f64a3cb8a"
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册