2

I want to pass a JSON object like {'inputNum': 8} from a python script on my local machine through a request and have the body return with whether the number is even or odd. I have a simple lambda function that checks this and it works with my test cases, but I do not know how to configure API Gateway to accept input from a request. This is my current code to request the API

if __name__ == '__main__':
    method = 'GET'
    headers = {'content-type': 'application/json'}
    body = {'inputNum': '8'}
    url = "****.amazon/prod/testEven"
    response = requests.request(method, url, data=body, headers=headers)
    print(response.text)

but it gives me {"message": "Internal server error"}

Any help is appreciated!

zdavidmm
  • 45
  • 1
  • 6

0 Answers0