mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-09 06:03:35 +00:00
pull APIs from GitHub master, import urllib2 once
This commit is contained in:
12
src/gam.py
12
src/gam.py
@ -40,6 +40,7 @@ import random
|
|||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import StringIO
|
import StringIO
|
||||||
|
import urllib2
|
||||||
|
|
||||||
import googleapiclient
|
import googleapiclient
|
||||||
import googleapiclient.discovery
|
import googleapiclient.discovery
|
||||||
@ -409,7 +410,6 @@ def SetGlobalVariables():
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def doGAMCheckForUpdates(forceCheck=False):
|
def doGAMCheckForUpdates(forceCheck=False):
|
||||||
import urllib2
|
|
||||||
import calendar
|
import calendar
|
||||||
|
|
||||||
current_version = gam_version
|
current_version = gam_version
|
||||||
@ -3091,7 +3091,6 @@ def doPhoto(users):
|
|||||||
filename = filename.replace(u'#username#', user[:user.find(u'@')])
|
filename = filename.replace(u'#username#', user[:user.find(u'@')])
|
||||||
print u"Updating photo for %s with %s (%s/%s)" % (user, filename, i, count)
|
print u"Updating photo for %s with %s (%s/%s)" % (user, filename, i, count)
|
||||||
if re.match(u'^(ht|f)tps?://.*$', filename):
|
if re.match(u'^(ht|f)tps?://.*$', filename):
|
||||||
import urllib2
|
|
||||||
try:
|
try:
|
||||||
f = urllib2.urlopen(filename)
|
f = urllib2.urlopen(filename)
|
||||||
image_data = str(f.read())
|
image_data = str(f.read())
|
||||||
@ -6250,6 +6249,7 @@ def doCreateProject(login_hint=None):
|
|||||||
while True:
|
while True:
|
||||||
create_again = False
|
create_again = False
|
||||||
print u'Creating project "%s"...' % body[u'name']
|
print u'Creating project "%s"...' % body[u'name']
|
||||||
|
break
|
||||||
create_operation = callGAPI(crm.projects(), u'create', body=body)
|
create_operation = callGAPI(crm.projects(), u'create', body=body)
|
||||||
operation_name = create_operation[u'name']
|
operation_name = create_operation[u'name']
|
||||||
time.sleep(5) # Google recommends always waiting at least 5 seconds
|
time.sleep(5) # Google recommends always waiting at least 5 seconds
|
||||||
@ -6283,12 +6283,10 @@ and accept the Terms of Service (ToS). As soon as you've accepted the ToS popup,
|
|||||||
print status[u'error']
|
print status[u'error']
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
break
|
break
|
||||||
|
apis_url = u'https://raw.githubusercontent.com/jay0lee/GAM/master/src/project-apis.txt'
|
||||||
|
request = urllib2.Request(url=apis_url)
|
||||||
|
apis = urllib2.urlopen(request).read().splitlines()
|
||||||
serveman = googleapiclient.discovery.build(u'servicemanagement', u'v1', http=http, cache_discovery=False)
|
serveman = googleapiclient.discovery.build(u'servicemanagement', u'v1', http=http, cache_discovery=False)
|
||||||
apis = [u'admin.googleapis.com', u'appsactivity.googleapis.com', u'calendar-json.googleapis.com',
|
|
||||||
u'classroom.googleapis.com', u'drive', u'gmail.googleapis.com', u'groupssettings.googleapis.com',
|
|
||||||
u'licensing.googleapis.com', u'plus.googleapis.com', u'contacts.googleapis.com',
|
|
||||||
u'siteverification.googleapis.com']
|
|
||||||
for api in apis:
|
for api in apis:
|
||||||
while True:
|
while True:
|
||||||
print u' enabling API %s...' % api
|
print u' enabling API %s...' % api
|
||||||
|
Reference in New Issue
Block a user