better way to handle per-API batch

This commit is contained in:
Jay Lee
2018-03-28 15:12:09 -04:00
parent a9025e2aba
commit 6a70a1412b

View File

@ -5461,8 +5461,7 @@ def doDeleteLabel(users):
bcount = 0
j = 0
del_me_count = len(del_labels)
batch_uri = gmail._rootDesc['rootUrl'] + gmail._rootDesc['batchPath']
dbatch = googleapiclient.http.BatchHttpRequest(batch_uri=batch_uri)
dbatch = gmail.new_batch_http_request()
for del_me in del_labels:
j += 1
print u' deleting label %s (%s/%s)' % (del_me[u'name'], j, del_me_count)
@ -5470,7 +5469,7 @@ def doDeleteLabel(users):
bcount += 1
if bcount == 10:
dbatch.execute()
dbatch = googleapiclient.http.BatchHttpRequest(batch_uri=batch_uri)
dbatch = gmail.new_batch_http_request()
bcount = 0
if bcount > 0:
dbatch.execute()
@ -8846,8 +8845,7 @@ def doGetUserInfo(user_email=None):
if getLicenses:
print u'Licenses:'
lic = buildGAPIObject(u'licensing')
batch_uri = lic._rootDesc['rootUrl'] + lic._rootDesc['batchPath']
lbatch = googleapiclient.http.BatchHttpRequest(callback=user_lic_result, batch_uri=batch_uri)
lbatch = lic.new_batch_http_request(callback=user_lic_result)
user_licenses = []
for sku in skus:
productId, skuId = getProductAndSKU(sku)