From 5e91c575c7767223200a078aae3c451cd0c0996e Mon Sep 17 00:00:00 2001 From: John Asmuth Date: Mon, 5 Jan 2015 13:47:32 -0500 Subject: [PATCH] delay the import of webbrowser webbrowser takes a long time to import, and it's usually not needed. --- oauth2client/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth2client/tools.py b/oauth2client/tools.py index f6c5829..8750645 100644 --- a/oauth2client/tools.py +++ b/oauth2client/tools.py @@ -27,7 +27,6 @@ __all__ = ['argparser', 'run_flow', 'run', 'message_if_missing'] import logging import socket import sys -import webbrowser from six.moves import BaseHTTPServer from six.moves import urllib @@ -187,6 +186,7 @@ def run_flow(flow, storage, flags, http=None): authorize_url = flow.step1_get_authorize_url() if not flags.noauth_local_webserver: + import webbrowser webbrowser.open(authorize_url, new=1, autoraise=True) print('Your browser has been opened to visit:') print()