python 2.7 - how to get return response from AWS Lambda function -


i have simple lambda function returns dict response , lambda function invokes function , prints response.

lambda function a

def handler(event,context):     params = event['list']     return {"params" : params + ["abc"]} 

lambda function b invoking a

a=[1,2,3] x = {"list" : a} invoke_response = lambda_client.invoke(functionname="monitor-workspaces-status",                                        invocationtype='event',                                        payload=json.dumps(x)) print (invoke_response) 

invoke_response

{u'payload': <botocore.response.streamingbody object @ 0x7f47c58a1e90>, 'responsemetadata': {'httpstatuscode': 202, 'requestid': '9a6a6820-0841-11e6-ba22-ad11a929daea'}, u'statuscode': 202} 

why response status 202? also, how response data invoke_response? not find clear documentation of how it.

a 202 response means accepted. successful response telling action have requested has been initiated has not yet completed. reason getting 202 because invoked lambda function asynchronously. invocationtype parameter set event. if want make synchronous call, change requestresponse.

once that, can returned data this:

data = invoke_response['payload'].read() 

Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -