84c43177c6cc611daf5e141339065d8969b3c089,tasks/pull_queue_snippets.py,,create_task,#Any#Any#Any#,28

Before Change


    response = client.projects().locations().queues().tasks().create(
        parent=queue_name, body=task).execute()

    print("Created task {}".format(response["name"]))
    return response
// [END cloud_tasks_create_task]

After Change


    from google.cloud import tasks_v2beta2

    // Create a client.
    client = tasks_v2beta2.CloudTasksClient()

    // Prepare the payload of type bytes.
    payload = "a message for the recipient".encode()

    // Construct the request body.
    task = {
        "pull_message": {
            "payload": payload,
        }
    }

    // Construct the fully qualified queue name.
    parent = client.queue_path(project, location, queue)

    // Use the client to build and send the task.
    response = client.create_task(parent, task)

    print("Created task: {}".format(response.name))
    return response
    // [END tasks_create_task]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 84c43177c6cc611daf5e141339065d8969b3c089
Time: 2018-06-18
Author: akitsch@google.com
File Name: tasks/pull_queue_snippets.py
Class Name:
Method Name: create_task


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 84c43177c6cc611daf5e141339065d8969b3c089
Time: 2018-06-18
Author: akitsch@google.com
File Name: tasks/pull_queue_snippets.py
Class Name:
Method Name: acknowledge_task


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 84c43177c6cc611daf5e141339065d8969b3c089
Time: 2018-06-18
Author: akitsch@google.com
File Name: tasks/pull_queue_snippets.py
Class Name:
Method Name: lease_task