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 cd4d473

Browse filesBrowse files
authored
Standardize on CamelCase, reword confusing endpoint name (GoogleCloudPlatform#1288)
1 parent 4f0ebc5 commit cd4d473
Copy full SHA for cd4d473

File tree

Expand file treeCollapse file tree

4 files changed

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

4 files changed

+13
-13
lines changed

‎appengine/flexible/tasks/create_app_engine_queue_task.py

Copy file name to clipboardExpand all lines: appengine/flexible/tasks/create_app_engine_queue_task.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def create_task(project, queue, location, payload=None, in_seconds=None):
3030
client = googleapiclient.discovery.build('cloudtasks', 'v2beta2')
3131

3232
# Construct the request body.
33-
url = '/log_payload'
33+
url = '/example_task_handler'
3434
body = {
3535
'task': {
36-
'app_engine_http_request': { # Specify the type of request.
37-
'http_method': 'POST',
38-
'relative_url': url
36+
'appEngineHttpRequest': { # Specify the type of request.
37+
'httpMethod': 'POST',
38+
'relativeUrl': url
3939
}
4040
}
4141
}
@@ -50,15 +50,15 @@ def create_task(project, queue, location, payload=None, in_seconds=None):
5050
converted_payload = base64_encoded_payload.decode()
5151

5252
# Add the payload to the request.
53-
body['task']['app_engine_http_request']['payload'] = converted_payload
53+
body['task']['appEngineHttpRequest']['payload'] = converted_payload
5454

5555
if in_seconds is not None:
5656
# Convert "seconds from now" into an rfc3339 datetime string.
5757
d = datetime.datetime.utcnow() + datetime.timedelta(seconds=in_seconds)
5858
scheduled_time = d.isoformat('T') + 'Z'
5959

6060
# Add the rfc3339 datetime string to the request.
61-
body['task']['schedule_time'] = scheduled_time
61+
body['task']['scheduleTime'] = scheduled_time
6262

6363
# Construct the fully qualified queue name.
6464
queue_name = 'projects/{}/locations/{}/queues/{}'.format(
@@ -104,7 +104,7 @@ def create_task(project, queue, location, payload=None, in_seconds=None):
104104
)
105105

106106
parser.add_argument(
107-
'--in_seconds',
107+
'--in_seconds', type=int,
108108
help='The number of seconds from now to schedule task attempt.'
109109
)
110110

‎appengine/flexible/tasks/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/tasks/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
app = Flask(__name__)
2121

2222

23-
@app.route('/log_payload', methods=['POST'])
24-
def log_payload():
23+
@app.route('/example_task_handler', methods=['POST'])
24+
def example_task_handler():
2525
"""Log the request payload."""
2626
payload = request.get_data(as_text=True) or '(empty payload)'
2727
print('Received task with payload: {}'.format(payload))

‎appengine/flexible/tasks/main_test.py

Copy file name to clipboardExpand all lines: appengine/flexible/tasks/main_test.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ def test_index(app):
3030
def test_log_payload(capsys, app):
3131
payload = 'test_payload'
3232

33-
r = app.post('/log_payload', data=payload)
33+
r = app.post('/example_task_handler', data=payload)
3434
assert r.status_code == 200
3535

3636
out, _ = capsys.readouterr()
3737
assert payload in out
3838

3939

4040
def test_empty_payload(capsys, app):
41-
r = app.post('/log_payload')
41+
r = app.post('/example_task_handler')
4242
assert r.status_code == 200
4343

4444
out, _ = capsys.readouterr()

‎tasks/pull_queue_snippets.py

Copy file name to clipboardExpand all lines: tasks/pull_queue_snippets.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create_task(project, queue, location):
4747
# Construct the request body.
4848
task = {
4949
'task': {
50-
'pull_message': {
50+
'pullMessage': {
5151
'payload': converted_payload
5252
}
5353
}
@@ -77,7 +77,7 @@ def pull_task(project, queue, location):
7777

7878
duration_seconds = '600s'
7979
pull_options = {
80-
'max_tasks': 1,
80+
'maxTasks': 1,
8181
'leaseDuration': duration_seconds,
8282
'responseView': 'FULL'
8383
}

0 commit comments

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