Skip to content

Commit 45b5758

Browse files
Pub/Sub: remove _ah in AppEngine Python3 sample (GoogleCloudPlatform#2686)
* remove the unnecessary _ah in sample * update tests
1 parent 95beb72 commit 45b5758

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

appengine/standard_python37/pubsub/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Before you can run or deploy the sample, you will need to do the following:
2525
$ gcloud beta pubsub subscriptions create [your-subscription-name] \
2626
--topic=[your-topic-name] \
2727
--push-endpoint=\
28-
https://[your-app-id].appspot.com/_ah/push-handlers/receive_messages?token=[your-token] \
28+
https://[your-app-id].appspot.com/push-handlers/receive_messages?token=[your-token] \
2929
--ack-deadline=30 \
3030
--push-auth-service-account=[your-service-account] \
3131
--push-auth-token-audience=example.com
@@ -56,11 +56,11 @@ Then set environment variables before starting your application:
5656
The application can send messages locally, but it is not able to receive push messages locally. You can, however, simulate a push message by making an HTTP request to the local push notification endpoint. There is an included ``sample_message.json``. You can use
5757
``curl`` or [httpie](https://github.com/jkbrzt/httpie) to POST this:
5858

59-
$ curl -i --data @sample_message.json "localhost:8080/_ah/push-handlers/receive_messages?token=[your-token]"
59+
$ curl -i --data @sample_message.json "localhost:8080/push-handlers/receive_messages?token=[your-token]"
6060

6161
Or
6262

63-
$ http POST ":8080/_ah/push-handlers/receive_messages?token=[your-token]" < sample_message.json
63+
$ http POST ":8080/push-handlers/receive_messages?token=[your-token]" < sample_message.json
6464

6565
Response:
6666

appengine/standard_python37/pubsub/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def index():
6060

6161

6262
# [START push]
63-
@app.route('/_ah/push-handlers/receive_messages', methods=['POST'])
63+
@app.route('/push-handlers/receive_messages', methods=['POST'])
6464
def receive_messages_handler():
6565
# Verify that the request originates from the application.
6666
if (request.args.get('token', '') !=

appengine/standard_python37/pubsub/main_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_push_endpoint(monkeypatch, client, fake_token):
8989
monkeypatch.setattr(id_token, 'verify_oauth2_token',
9090
_verify_mocked_oauth2_token)
9191

92-
url = '/_ah/push-handlers/receive_messages?token=' + \
92+
url = '/push-handlers/receive_messages?token=' + \
9393
os.environ['PUBSUB_VERIFICATION_TOKEN']
9494

9595
r = client.post(
@@ -115,9 +115,9 @@ def test_push_endpoint(monkeypatch, client, fake_token):
115115

116116
def test_push_endpoint_errors(client):
117117
# no token
118-
r = client.post('/_ah/push-handlers/receive_messages')
118+
r = client.post('/push-handlers/receive_messages')
119119
assert r.status_code == 400
120120

121121
# invalid token
122-
r = client.post('/_ah/push-handlers/receive_messages?token=bad')
122+
r = client.post('/push-handlers/receive_messages?token=bad')
123123
assert r.status_code == 400

0 commit comments

Comments
 (0)