Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WouterNieuwerth/1a941e5883bb3537f69955273d703f5f to your computer and use it in GitHub Desktop.
Save WouterNieuwerth/1a941e5883bb3537f69955273d703f5f to your computer and use it in GitHub Desktop.
def hello_world(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
"""
request_json = request.get_json()
if request_json and 'example_content' and 'another_example_content' in request_json:
example_content = request_json['example_content']
another_example_content = request_json['another_example_content']
# Do whatever you want with the data from the json
return str(example_content)
else:
return f'Error, no example_content or another_example_content found in json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment