Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fix: Update sample comments
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch committed Dec 21, 2020
1 parent cb1c361 commit 6850144
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 2 additions & 0 deletions samples/snippets/create_http_task.py
Expand Up @@ -37,6 +37,8 @@ def create_http_task(
# location = 'us-central1'
# url = 'https://example.com/task_handler'
# payload = 'hello' or {'param': 'value'} for application/json
# in_seconds = 180
# task_name = 'my-unique-task'

# Construct the fully qualified queue name.
parent = client.queue_path(project, location, queue)
Expand Down
17 changes: 0 additions & 17 deletions samples/snippets/create_http_task_with_token.py
Expand Up @@ -24,8 +24,6 @@ def create_http_task(
url,
service_account_email,
payload=None,
in_seconds=None,
task_name=None,
):
# [START cloud_tasks_create_http_task_with_token]
"""Create a task for a given queue with an arbitrary payload."""
Expand Down Expand Up @@ -63,21 +61,6 @@ def create_http_task(
# Add the payload to the request.
task["http_request"]["body"] = converted_payload

if in_seconds is not None:
# Convert "seconds from now" into an rfc3339 datetime string.
d = datetime.datetime.utcnow() + datetime.timedelta(seconds=in_seconds)

# Create Timestamp protobuf.
timestamp = timestamp_pb2.Timestamp()
timestamp.FromDatetime(d)

# Add the timestamp to the tasks.
task["schedule_time"] = timestamp

if task_name is not None:
# Add the name to tasks.
task["name"] = task_name

# Use the client to build and send the task.
response = client.create_task(request={"parent": parent, "task": task})

Expand Down

0 comments on commit 6850144

Please sign in to comment.