i'm using google api client batchhttprequest fetch bunch of threads gmail. can access response object in callback function provide, how access in function makes call batch.execute()
?
to illustrate, have following functions:
def get_threads(user_id, thread_ids): retrieved_threads = [] batch = service.new_batch_http_request(callback=thread_batch_callback) # omitting service comes from, it's there thread_id in thread_ids: batch.add(service.users().threads().get(userid=user_id, id=thread_id)) batch.execute() # ideally response # retrieved_threads = ???.response return retrieved_threads def thread_batch_callback(request_id, response, exception): if exception not none: print(exception) return none else: return response # how access in calling function?
seems i'm missing straightforward. appreciated!
Comments
Post a Comment