Add fixes back for oauth2client

This commit is contained in:
Jay Lee
2015-09-30 09:57:49 -04:00
parent 58335025c4
commit 27b31ff1fb
3 changed files with 15 additions and 8 deletions

View File

@ -593,7 +593,7 @@ def buildGAPIObject(api):
pyinstaller_disc_file = None pyinstaller_disc_file = None
try: try:
pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename) pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
except NameError: except (NameError, AttributeError):
pass pass
if os.path.isfile(disc_file): if os.path.isfile(disc_file):
f = file(disc_file, 'rb') f = file(disc_file, 'rb')
@ -687,7 +687,7 @@ def buildGAPIServiceObject(api, act_as=None, soft_errors=False):
pyinstaller_disc_file = None pyinstaller_disc_file = None
try: try:
pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename) pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
except NameError: except (NameError, AttributeError):
pass pass
if os.path.isfile(disc_file): if os.path.isfile(disc_file):
f = file(disc_file, 'rb') f = file(disc_file, 'rb')

View File

@ -8,7 +8,7 @@ for d in a.datas:
if 'pyconfig' in d[0]: if 'pyconfig' in d[0]:
a.datas.remove(d) a.datas.remove(d)
break break
a.datas += [('httplib2/cacerts.txt', '\python27-32\lib\site-packages\httplib2\cacerts.txt', 'DATA')] a.datas += [('httplib2/cacerts.txt', 'httplib2\cacerts.txt', 'DATA')]
a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')] a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')]
a.datas += [('admin-settings-v1.json', 'admin-settings-v1.json', 'DATA')] a.datas += [('admin-settings-v1.json', 'admin-settings-v1.json', 'DATA')]
pyz = PYZ(a.pure) pyz = PYZ(a.pure)

View File

@ -194,6 +194,16 @@ def run_flow(flow, storage, flags, http=None):
flow.redirect_uri = oauth_callback flow.redirect_uri = oauth_callback
authorize_url = flow.step1_get_authorize_url() authorize_url = flow.step1_get_authorize_url()
if flags.short_url:
try:
from googleapiclient.discovery import build
service = build('urlshortener', 'v1', http=http)
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:
import webbrowser import webbrowser
webbrowser.open(authorize_url, new=1, autoraise=True) webbrowser.open(authorize_url, new=1, autoraise=True)
@ -201,11 +211,8 @@ def run_flow(flow, storage, flags, http=None):
print() print()
print(' ' + authorize_url) print(' ' + authorize_url)
print() print()
print('If your browser is on a different machine then ' print('If your browser is on a different machine then exit and re-run this')
'exit and re-run this') print('after creating a file called nobrowser.txt in the same path as GAM.')
print('application with the command-line parameter ')
print()
print(' --noauth_local_webserver')
print() print()
else: else:
print('Go to the following link in your browser:') print('Go to the following link in your browser:')