depot_tools: Clean up auth.py

Bug: 1001756
Change-Id: I495991c30f7f00de17e7c098e2d88ef7783aff3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1865265
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This commit is contained in:
Edward Lemur
2019-10-21 17:57:39 +00:00
committed by Commit Bot
parent a0aed87f71
commit 5b929a4926
8 changed files with 72 additions and 404 deletions

View File

@@ -292,12 +292,10 @@ class MyActivity(object):
return ret
def monorail_get_auth_http(self):
auth_config = auth.extract_auth_config_from_options(self.options)
authenticator = auth.get_authenticator(auth_config)
# Manually use a long timeout (10m); for some users who have a
# long history on the issue tracker, whatever the default timeout
# is is reached.
return authenticator.authorize(httplib2.Http(timeout=600))
return auth.Authenticator().authorize(httplib2.Http(timeout=600))
def filter_modified_monorail_issue(self, issue):
"""Precisely checks if an issue has been modified in the time range.
@@ -809,7 +807,6 @@ def main():
'-j', '--json', action='store_true',
help='Output json data (overrides other format options)')
parser.add_option_group(output_format_group)
auth.add_auth_options(parser)
parser.add_option(
'-v', '--verbose',
@@ -925,8 +922,8 @@ def main():
my_activity.get_issues()
if not options.no_referenced_issues:
my_activity.get_referenced_issues()
except auth.AuthenticationError as e:
logging.error('auth.AuthenticationError: %s', e)
except auth.LoginRequiredError as e:
logging.error('auth.LoginRequiredError: %s', e)
my_activity.show_progress('\n')