gcloud-aio

repository·master·Indexed 43 days ago

https://github.com/talkiq/gcloud-aio

A collection of HTTP-based Python client libraries for Google Cloud services. It provides two distinct implementations: `gcloud-aio-*` for non-blocking asynchronous I/O using asyncio and aiohttp, and `gcloud-rest-*` for threadsafe synchronous workflows using requests. Supported services include Auth, BigQuery, Datastore, KMS, PubSub, Storage, and Task Queue.

Tokens
1.3K
Snippets
8
Records
12
Agent score
55%

What's inside gcloud-aio

  1. Understand the core authentication classes

    master

    The library provides three primary classes for different Google Cloud authentication scenarios:

    1. IamClient: Used to interact with GCP public keys and to sign blobs via URL.
    2. IapToken: Used for authorizing against an Identity-Aware Proxy (IAP) secured GCP service. Each instance corresponds to an ID token specific to a single target service.
    3. Token: The standard class used for general Google Cloud authorization. Other gcloud-aio-* package components (like BigQuery, Storage, etc.) accept a Token instance as an argument. You can use a single Token across multiple components or define unique tokens for each service by specifying the required scopes.
  2. Understand the difference between gcloud-aio and gcloud-rest

    master

    The repository provides two distinct HTTP-based implementations of Google Cloud client libraries for Python:

    1. gcloud-aio-*: Built using asyncio and the aiohttp library. Use this when you need non-blocking, asynchronous I/O.
    2. gcloud-rest-*: A threadsafe implementation built using the requests library. Use this for standard synchronous or multi-threaded workflows.

    Both implementations serve as alternatives to the official Google Cloud client libraries by providing HTTP-based access to Google Cloud services.

  3. Install gcloud-aio or gcloud-rest client libraries

    master

    This repository provides two distinct types of HTTP implementations for Google Cloud client libraries in Python:

    1. gcloud-aio-*: Built specifically for Python 3's asyncio (asynchronous/non-blocking).
    2. gcloud-rest-*: A threadsafe implementation based on the requests library.

    To install a specific client, use pip install with the appropriate prefix (gcloud-aio- or gcloud-rest-) followed by the service name.

    # Example for installing the asyncio version of BigQuery
    $ pip install --upgrade gcloud-aio-bigquery
    
    # Example for installing the requests-based version of BigQuery
    $ pip install --upgrade gcloud-rest-bigquery
  4. Install gcloud-aio-auth or gcloud-rest-auth

    master

    You can install the asynchronous version (gcloud-aio-auth) or the REST version (gcloud-rest-auth) using pip. It is recommended to use the --upgrade flag to ensure you have the latest version.

    $ pip install --upgrade gcloud-{aio,rest}-auth
  5. Install gcloud-aio-storage

    master

    You can install the library using pip. The codebase supports both the aio (asyncio) and rest versions.

    To install the asyncio version:

    pip install --upgrade gcloud-aio-storage

    To install the REST version:

    pip install --upgrade gcloud-rest-storage
    pip install --upgrade gcloud-aio-storage
  6. Install gcloud-aio-pubsub or gcloud-rest-pubsub

    master

    You can install either the asyncio-based client (gcloud-aio-pubsub) or the REST-based client (gcloud-rest-pubsub) using pip. Use the following command to upgrade or install the package:

    $ pip install --upgrade gcloud-{aio,rest}-pubsub
  7. Install gcloud-aio-datastore or gcloud-rest-datastore

    master

    You can install either the asyncio-based client (gcloud-aio-datastore) or the REST-based client (gcloud-rest-datastore) using pip. Use the following command to ensure you have the latest version:

    $ pip install --upgrade gcloud-{aio,rest}-datastore
  8. Available Google Cloud client libraries

    master

    The following Google Cloud services are supported through individual client packages. You can choose between the asyncio (gcloud-aio-*) or requests-based (gcloud-rest-*) implementation for each:

    • Auth: gcloud-aio-auth / gcloud-rest-auth
    • BigQuery: gcloud-aio-bigquery / gcloud-rest-bigquery
    • Datastore: gcloud-aio-datastore / gcloud-rest-datastore
    • KMS: gcloud-aio-kms / gcloud-rest-kms
    • PubSub: gcloud-aio-pubsub / gcloud-rest-pubsub
    • Storage: gcloud-aio-storage / gcloud-rest-storage
    • Task Queue: gcloud-aio-taskqueue / gcloud-rest-taskqueue
  9. Supported authentication methods

    master

    The library supports the following authentication methods:

    • Service account credentials
    • Authorized user credentials
    • GCE metadata credentials
    • Impersonated service account credentials
    • External account credentials (for workload identity federation)