Skip to content

Commit 6f8fbfb

Browse files
josueetcomAce Nassri
andauthored
chore(functions/v2): Update sample signatures using functions framework (#8884)
* Update multipart sample signature using functions framework * Update rest of functions to FF * Update functions/http/main.py Co-authored-by: Ace Nassri <[email protected]> * Fix lint * Fix lint, take 2 Co-authored-by: Ace Nassri <[email protected]>
1 parent bb1c1df commit 6f8fbfb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

functions/http/main.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
import tempfile
2222
# [END functions_http_form_data]
2323

24+
# [START functions_http_cors]
25+
# [START functions_http_cors_auth]
26+
# [START functions_http_xml]
27+
# [START functions_http_form_data]
28+
import functions_framework
29+
30+
# [END functions_http_form_data]
31+
# [END functions_http_xml]
32+
# [END functions_http_cors_auth]
33+
# [END functions_http_cors]
34+
2435
# [START functions_http_form_data]
2536
from werkzeug.utils import secure_filename
2637
# [END functions_http_form_data]
@@ -31,7 +42,7 @@
3142

3243

3344
# [START functions_http_xml]
34-
45+
@functions_framework.http
3546
def parse_xml(request):
3647
""" Parses a document of type 'text/xml'
3748
Args:
@@ -56,6 +67,7 @@ def get_file_path(filename):
5667
return os.path.join(tempfile.gettempdir(), file_name)
5768

5869

70+
@functions_framework.http
5971
def parse_multipart(request):
6072
""" Parses a 'multipart/form-data' upload request
6173
Args:
@@ -92,6 +104,7 @@ def parse_multipart(request):
92104

93105

94106
# [START functions_http_cors]
107+
@functions_framework.http
95108
def cors_enabled_function(request):
96109
# For more information about CORS and CORS preflight requests, see:
97110
# https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request
@@ -119,6 +132,7 @@ def cors_enabled_function(request):
119132

120133

121134
# [START functions_http_cors_auth]
135+
@functions_framework.http
122136
def cors_enabled_function_auth(request):
123137
# For more information about CORS and CORS preflight requests, see
124138
# https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

functions/http/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
functions-framework==3.3.0
12
google-cloud-storage==2.0.0; python_version < '3.7'
23
google-cloud-storage==2.1.0; python_version > '3.6'
34
xmltodict==0.13.0

0 commit comments

Comments
 (0)