forked from serverless/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 693 Bytes
/
main.py
File metadata and controls
30 lines (22 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""GCP HTTP Cloud Function Example."""
# -*- coding: utf-8 -*-
import json
import datetime
def endpoint(request):
"""GCP HTTP Cloud Function Example.
Args:
request (flask.Request)
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/0.12/api/#flask.Flask.make_response>.
"""
current_time = datetime.datetime.now().time()
body = {
"message": "Received a {} request at {}".format(request.method, str(current_time))
}
response = {
"statusCode": 200,
"body": body
}
return json.dumps(response, indent=4)