From 0cd8246bdb21b7f14ad608a9d5006558374d1d65 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 30 Dec 2015 12:58:21 -0500 Subject: [PATCH 1/3] remove unused G+ APIs --- src/gam.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gam.py b/src/gam.py index bf964cf3..9992265d 100755 --- a/src/gam.py +++ b/src/gam.py @@ -765,8 +765,6 @@ API_VER_MAPPING = { u'groupssettings': u'v1', u'licensing': u'v1', u'oauth2': u'v2', - u'plus': u'v1', - u'plusDomains': u'v1', u'reports': u'reports_v1', u'siteVerification': u'v1', } From 7515700b1adcd344ba3cfe8e2d1392b1e68d3c45 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 30 Dec 2015 13:18:56 -0500 Subject: [PATCH 2/3] fix GC_Defaults dict init --- src/gam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gam.py b/src/gam.py index 9992265d..33d83f3c 100755 --- a/src/gam.py +++ b/src/gam.py @@ -178,7 +178,7 @@ GC_USER_MAX_RESULTS = u'user_max_results' GC_Defaults = { GC_ACTIVITY_MAX_RESULTS: 100, - GC_ADMIN = u'', + GC_ADMIN: u'', GC_AUTO_BATCH_MIN: 0, GC_CACHE_DIR: u'', GC_CHARSET: u'utf-8', From d871378336fec4b99d1a9122c1c211cc7f91ea7f Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 30 Dec 2015 13:25:06 -0500 Subject: [PATCH 3/3] dynamically get API scopes for "gam oauth request" --- src/gam.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gam.py b/src/gam.py index 33d83f3c..8eebc0f0 100755 --- a/src/gam.py +++ b/src/gam.py @@ -8712,7 +8712,26 @@ def OAuthInfo(): print u'Google Apps Admin: Unknown' def doRequestOAuth(): - pass + admin_email = raw_input(u'Please enter your admin email address: ') + apis = API_VER_MAPPING.keys() + apis.remove(u'oauth2') + for api in apis: + version = getAPIVer(api) + if api in [u'directory', u'reports', u'datatransfer']: + api = u'admin' + http = httplib2.Http(disable_ssl_certificate_validation=GC_Values[GC_NO_VERIFY_SSL], + cache=GC_Values[GC_CACHE_DIR]) + try: + service = googleapiclient.discovery.build(api, version, http=http, cache_discovery=False) + except googleapiclient.errors.UnknownApiNameOrVersion: + service = getServiceFromDiscoveryDocument(api, version, http) + print u'%s: %s' % (service._rootDesc['title'], service._rootDesc['description']) + for scope in service._rootDesc[u'auth'][u'oauth2'][u'scopes'].items(): + scope_value = scope[0] + scope_description = scope[1][u'description'] + print u' %s\n %s' % (scope_value, scope_description) + print + print def batch_worker(): while True: