From 6a70a1412b65893ec6db4c853b437e2eae5df7d1 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 28 Mar 2018 15:12:09 -0400 Subject: [PATCH] better way to handle per-API batch --- src/gam.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gam.py b/src/gam.py index 6680f3e8..d9254a02 100755 --- a/src/gam.py +++ b/src/gam.py @@ -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)