title: AWS Lambda Function is misinterpreting event dictionary in python?
body: <p>I am trying to deploy a google calendar api to AWS Lambda. Since I was facing a problem in extracting the value from the event dictionary (created by lambda from the JSON payload of a POST request), i created a toy function to test</p>
  
  <pre><code>def handler(event,context):
      a=event.get("type")
  
      if a=='create':
          return {
                  "statusCode": 200,
                  "headers": { "Content-Type": "text/plain"},
                  #"body": "Event_id"+ str(event_identifier) + " Event Link: " +str(links)
                  "body" : str(a)
              }
      else:
          return {
                  "statusCode": 200,
                  "headers": { "Content-Type": "text/plain"},
                  #"body": "Event_id"+ str(event_identifier) + " Event Link: " +str(links)
                  "body" : "nope"
              }
  </code></pre>
  
  <p>While testing on the Lambda console with the following JSON, I get the correct response.</p>
  
  <p>Test Payload:
      {
        "start_time" : "2018-01-24T09:00:00",
        "end_time" : "2018-01-24T13:00:00",
        "type": "create",
        "event_identifier": "pvno",
        "summary": "Company",
        "booking-email": "abc@example.com"
      }</p>
  
  <p>Response:</p>
  
  <pre><code>{
    "body": "create",
    "headers": {
      "Content-Type": "text/plain"
    },
    "statusCode": 200
  }
  </code></pre>
  
  <p>When I send the same payload from postman(binary or body POST) (or test on API gateway console), I get "None" when I return the value from event.get("type"). </p>
  
  <p>To explain further, if I try and get the event.get('body') and return it all as a string I get the below, which is incorrect according to how the lambda event should work:</p>
  
  <pre><code>{
    "start_time" : "2018-01-24T09:00:00",
    "end_time" : "2018-01-24T13:00:00",
    "type": "create",
    "event_identifier": "pvnoc",
    "summary": "Company",
    "booking-email": "abc@example.com"
  }
  </code></pre>
  
  <p>My questions:</p>
  
  <ul>
  <li>What am I doing wrong? </li>
  <li>How can I get the correct value from the event dictionary?</li>
  </ul>