title: How to get HTTP POST data in AWS lambda via API Gateway using Python
body: <p>Having an AWS lambda function (Python 3.6) triggered by API Gateway, I need to retrieve and process data from http request. </p>
  
  <p>The lambda function will be trigger by an API Gateway, say <a href="https://aws-uri/some-api-gateway" rel="nofollow noreferrer">https://aws-uri/some-api-gateway</a></p>
  
  <p>e.g. POST with data 
  param1: test
  param2: test2</p>
  
  <pre><code>curl -X POST \
    https://aws-uri/some-api-gateway \
    -F param1=test \
    -F param2=test2
  </code></pre>
  
  <p>The lambda function will need to retrieve the HTTP POST data for further process. </p>
  
  <p>param1: test
  param2: test2</p>
  
  <pre><code>def lambda_handler(event, context):
      # not sure if params should be retrieved from event,
      # or from http server
      print(event['param1'])
      print(event['param2'])
      return {
          'statusCode': 200,
          'body': json.dumps('test!')
      }
  </code></pre>
  
  <p>What's the best practice to implement this lambda function?</p>