Use per-API batchPath to work around universal www.googleapis.com/batch URI deprecation

This commit is contained in:
Jay Lee
2018-03-26 15:36:14 -04:00
parent b1e26e3a48
commit a9025e2aba

View File

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