Skip to content

Commit 8a8b32e

Browse files
chore(gae): fix region tags in standard_python3/pubsub/ (#13133)
* chore(gae): add new region tags to app.yaml * chore(gae): delete unused and add new region tags to main.py
1 parent 6cba173 commit 8a8b32e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

appengine/standard_python3/pubsub/app.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414

1515
runtime: python39
1616

17+
# [START gae_standard_pubsub_env]
1718
#[START env]
1819
env_variables:
1920
PUBSUB_TOPIC: '<YOUR_TOPIC>'
2021
# This token is used to verify that requests originate from your
2122
# application. It can be any sufficiently random string.
2223
PUBSUB_VERIFICATION_TOKEN: '<YOUR_VERIFICATION_TOKEN>'
2324
#[END env]
25+
# [END gae_standard_pubsub_env]

appengine/standard_python3/pubsub/main.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
1615
import base64
1716
import json
1817
import logging
@@ -39,6 +38,7 @@
3938
CLAIMS = []
4039

4140

41+
# [START gae_standard_pubsub_index]
4242
# [START index]
4343
@app.route("/", methods=["GET", "POST"])
4444
def index():
@@ -58,9 +58,8 @@ def index():
5858
future = publisher.publish(topic_path, data)
5959
future.result()
6060
return "OK", 200
61-
62-
6361
# [END index]
62+
# [END gae_standard_pubsub_index]
6463

6564

6665
# [START gae_standard_pubsub_auth_push]
@@ -104,10 +103,9 @@ def receive_messages_handler():
104103
MESSAGES.append(payload)
105104
# Returning any 2xx status indicates successful receipt of the message.
106105
return "OK", 200
107-
108-
109106
# [END gae_standard_pubsub_auth_push]
110107

108+
111109
# [START gae_standard_pubsub_push]
112110
@app.route("/pubsub/push", methods=["POST"])
113111
def receive_pubsub_messages_handler():
@@ -118,9 +116,9 @@ def receive_pubsub_messages_handler():
118116
envelope = json.loads(request.data.decode("utf-8"))
119117
payload = base64.b64decode(envelope["message"]["data"])
120118
MESSAGES.append(payload)
119+
121120
# Returning any 2xx status indicates successful receipt of the message.
122121
return "OK", 200
123-
124122
# [END gae_standard_pubsub_push]
125123

126124

@@ -142,4 +140,3 @@ def server_error(e):
142140
# This is used when running locally. Gunicorn is used to run the
143141
# application on Google App Engine. See entrypoint in app.yaml.
144142
app.run(host="127.0.0.1", port=8080, debug=True)
145-
# [END app]

0 commit comments

Comments
 (0)