mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-07 13:13:34 +00:00
Have short URL use a key and catch any errors
This commit is contained in:
@ -178,11 +178,14 @@ def run_flow(flow, storage, flags, http=None):
|
|||||||
authorize_url = flow.step1_get_authorize_url()
|
authorize_url = flow.step1_get_authorize_url()
|
||||||
|
|
||||||
if flags.short_url:
|
if flags.short_url:
|
||||||
from googleapiclient.discovery import build
|
try:
|
||||||
service = build('urlshortener', 'v1', http=http)
|
from googleapiclient.discovery import build
|
||||||
url_result = service.url().insert(body={'longUrl': authorize_url}).execute()
|
service = build('urlshortener', 'v1', http=http)
|
||||||
authorize_url = url_result['id']
|
url_result = service.url().insert(body={'longUrl': authorize_url},
|
||||||
|
key=u'AIzaSyBlmgbii8QfJSYmC9VTMOfqrAt5Vj5wtzE').execute()
|
||||||
|
authorize_url = url_result['id']
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if not flags.noauth_local_webserver:
|
if not flags.noauth_local_webserver:
|
||||||
webbrowser.open(authorize_url, new=1, autoraise=True)
|
webbrowser.open(authorize_url, new=1, autoraise=True)
|
||||||
print 'Your browser has been opened to visit:'
|
print 'Your browser has been opened to visit:'
|
||||||
|
Reference in New Issue
Block a user