Skip to content

Instantly share code, notes, and snippets.

@Mgancita
Created February 22, 2022 19:39
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 Mgancita/3a58dc166afcb7e1a8976f2dd73627cb to your computer and use it in GitHub Desktop.
Save Mgancita/3a58dc166afcb7e1a8976f2dd73627cb to your computer and use it in GitHub Desktop.
def hello_http(request):
"""HTTP Cloud Function.
Args:
request (flask.Request): The request object.
<https://flask.palletsprojects.com/en/1.1.x/api/#incoming-request-data>
Returns:
The response text, or any set of values that can be turned into a
Response object using `make_response`
<https://flask.palletsprojects.com/en/1.1.x/api/#flask.make_response>.
"""
request_json = request.get_json(silent=True)
request_args = request.args
if request_json and 'name' in request_json:
name = request_json['name']
elif request_args and 'name' in request_args:
name = request_args['name']
else:
name = 'World'
return f"Hello {name}!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment