Batch Request to Google API making calls before the batch executes in Python? -


i working on sending large batch request google api through admin sdk add members groups based upon groups in our in-house servers(a realignment script). using python , access google api using [apiclient library][1]. when create service , batch object, creation of service object requests url.

batch_count = 0 batch = batchhttprequest() service = build('admin', 'directory_v1') 

logs

info:apiclient.discovery:url being requested: https://www.googleapis.com/discovery/v1/apis/admin/directory_v1/rest 

which makes sense json object returned http call used build service object.

now want add multiple requests batch object, this;

for email in add_user_list:     if batch_count != 999:         add_body = dict()         add_body[u'email'] = email.lower()         n in range(0, 5):             try:                 batch.add(service.members().insert(groupkey=groupkey, body=add_body), callback=batch_callback)                 batch_count += 1                 break             except httperror, error:                 logging_message('quota exceeded, waiting retry...')                 time.sleep((2 ** n)                 continue 

every time iterates through outermost loop logs (group address redacted)

info:apiclient.discovery:url being requested: https://www.googleapis.com/admin/directory/v1/groups/groupaddress/members?alt=json 

isn't point of batch not send out calls api until batch request has been populated individual requests? why make call api shown above every time? when batch.execute() carries out requests (which area thought making calls api?)

for second thought call construct object returned .members() tried these changes:

service = build('admin', 'directory_v1').members()  batch.add(service.insert(groupkey=groupkey, body=add_body), callback=batch_callback) 

and got same result still. reason issue because doubling number of requests api , have real quota concerns @ scale running at.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -