Registry / gcp / gcloud-rest-taskqueue

gcloud-rest-taskqueue

JSON →
library7.0.0pypypiunverified

The `gcloud-rest-taskqueue` library provides an asynchronous Python client for interacting with Google Cloud Task Queue. It is part of the `gcloud-aio` monorepo, offering async functionality (via `aiohttp`) for various Google Cloud services. Currently at version 7.0.0, it follows a demand-driven release cadence as part of the larger `gcloud-aio` project.

pip install gcloud-rest-taskqueue
INSTALL
IMPORT
SIG · GCLOUD-REST-TASKQU
G
gcloud-rest-taskqueue
gcppythonv7.0.0
Install
4.0s avg
Import
—
Disk
54MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v7.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 54.5MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 4.0s · import 0.000s · 55MB
54MB installed
● package 54MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TaskQueueClient
✓ from gcloud.aio.taskqueue import TaskQueueClient
✗ from gcloud.aio.taskqueue import TaskQueueClient

This quickstart demonstrates how to initialize the `TaskQueueClient` and create a task asynchronously. Ensure your `GCLOUD_PROJECT` environment variable is set and that Google Application Credentials are available for authentication.

import asyncio import os from gcloud.aio.auth import build_from_env from gcloud.aio.taskqueue import TaskQueueClient async def main(): async with build_from_env() as client_session: # Replace with your actual project ID and desired location project_id = os.environ.get("GCLOUD_PROJECT", "your-gcp-project-id") location = os.environ.get("GCLOUD_TASKQUEUE_LOCATION", "us-east1") # e.g., 'us-central1' queue_name = os.environ.get("GCLOUD_TASKQUEUE_NAME", "my-queue") # e.g., 'my-queue' if not project_id or project_id == "your-gcp-project-id": print("Please set GCLOUD_PROJECT environment variable or replace 'your-gcp-project-id'.") return client = TaskQueueClient( project=project_id, location=location, session=client_session ) task_name = "my-test-task-1" payload = {"data": "hello world", "timestamp": "2023-01-01T12:00:00Z"} try: await client.create_task( project=project_id, location=location, queue_name=queue_name, task_name=task_name, payload=payload ) print(f"Task '{task_name}' created successfully in queue '{queue_name}' in project '{project_id}'.") except Exception as e: print(f"Failed to create task: {e}") if __name__ == '__main__': asyncio.run(main())
Debug
Known issues
breakingVersion 7.0.0 of `gcloud-rest-taskqueue` (and `gcloud-aio-taskqueue`) drops support for Python 3.7. Users on Python 3.7 should remain on version 6.x or upgrade their Python interpreter.
fix
Upgrade Python to 3.8+ or pin `gcloud-rest-taskqueue` to `<7.0.0`.
affects: 7.0.0+
breakingVersion 6.0.0 of `gcloud-rest-taskqueue` (and `gcloud-aio-taskqueue`) dropped support for Python 3.6. Users on Python 3.6 should remain on version 5.x or upgrade their Python interpreter.
fix
Upgrade Python to 3.7+ or pin `gcloud-rest-taskqueue` to `<6.0.0`.
affects: 6.0.0+
gotchaThis library is an asynchronous client. All API calls must be `await`ed within an `async def` function, which then needs to be executed using `asyncio.run()` (or similar event loop management). Direct synchronous calls will result in `RuntimeError` or `NameError`.
fix
Ensure all client method calls are prefixed with `await` and the entry point uses `asyncio.run()`.
affects: All
gotchaAuthentication relies on Google Application Credentials. If not explicitly provided, the client will attempt to infer them from the environment (e.g., `GOOGLE_APPLICATION_CREDENTIALS` environment variable pointing to a service account key file, or default credentials when running on GCP services).
fix
Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your service account JSON key file, or ensure appropriate IAM roles are assigned to your GCP service.
affects: All
gotchaThis `gcloud-rest-taskqueue` library (part of `gcloud-aio`) is an *asynchronous* client using `aiohttp`. It is distinct from Google's official `google-cloud-tasks` client library, which uses gRPC and offers both synchronous and wrapped asynchronous APIs. The API signatures and underlying implementations are different.
fix
Choose the client that best fits your application's asynchronous requirements and ensure you consult the correct documentation for the chosen library.
affects: All
Upgrade
Version history
7.0.0latest on PyPI · released Sep 13, 2023
Audit
Dependencies
aiohttprequiredCore asynchronous HTTP client dependency.
async-timeoutrequiredUsed for managing connection timeouts.
gcloud-aio-authrequiredProvides asynchronous Google Cloud authentication utilities, used by the TaskQueue client.
Agent activity
30 hits · last 30 days
node
28
OpenAI (training)
1
Resources
gcloud-rest-taskqueue — pip install gcloud-rest-taskqueue · libregistry