Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6452e74

Browse filesBrowse files
authored
refactor: Rename data to event (GoogleCloudPlatform#2357)
1 parent f1e6054 commit 6452e74
Copy full SHA for 6452e74

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎functions/helloworld/main.py

Copy file name to clipboardExpand all lines: functions/helloworld/main.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ def hello_get(request):
3939

4040

4141
# [START functions_helloworld_background]
42-
def hello_background(data, context):
42+
def hello_background(event, context):
4343
"""Background Cloud Function.
4444
Args:
45-
data (dict): The dictionary with data specific to the given event.
45+
event (dict): The dictionary with data specific to the given event.
4646
context (google.cloud.functions.Context): The Cloud Functions event
4747
metadata.
4848
"""
49-
if data and 'name' in data:
50-
name = data['name']
49+
if event and 'name' in event:
50+
name = event['name']
5151
else:
5252
name = 'World'
5353
return 'Hello {}!'.format(name)
@@ -104,14 +104,14 @@ def hello_pubsub(event, context):
104104

105105

106106
# [START functions_helloworld_storage]
107-
def hello_gcs(data, context):
107+
def hello_gcs(event, context):
108108
"""Background Cloud Function to be triggered by Cloud Storage.
109109
Args:
110-
data (dict): The dictionary with data specific to this type of event.
110+
event (dict): The dictionary with data specific to this type of event.
111111
context (google.cloud.functions.Context): The Cloud Functions
112112
event metadata.
113113
"""
114-
print("File: {}.".format(data['objectId']))
114+
print("File: {}.".format(event['objectId']))
115115
# [END functions_helloworld_storage]
116116

117117

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.