A client library for accessing CockroachDB Cloud API
Project description
cockroachdb-cloud-client
A client library for accessing the CockroachDB Cloud API.
Read the CockroachDB Cloud OpenAPI Spec on our docs page.
Usage
First, create a client, then, call your endpoint and use your models:
from cockroachdb_cloud_client import AuthenticatedClient
from cockroachdb_cloud_client.models import ListClustersResponse
from cockroachdb_cloud_client.api.cockroach_cloud import cockroach_cloud_list_clusters
from cockroachdb_cloud_client.types import Response
import os
cc_key = os.environ['CC_KEY']
client = AuthenticatedClient(
base_url="https://cockroachlabs.cloud",
token=cc_key,
headers={"cc-version": "2022-09-20"},
)
resp: Response[ListClustersResponse] = cockroach_cloud_list_clusters.sync_detailed(client=client)
for x in resp.parsed.clusters:
print(x.name)
# Output:
# cute-otter
# gummy-rabbit
# half-weasel
# itchy-donkey
# redear-thrush
Things to know
-
Every path/method combo becomes a Python module with four functions:
sync
: Blocking request that returns parsed data (if successful) orNone
sync_detailed
: Blocking request that always returns aRequest
, optionally withparsed
set if the request was successful.asyncio
: Likesync
but async instead of blockingasyncio_detailed
: Likesync_detailed
but async instead of blocking
-
All path/query params, and bodies become method arguments.
-
If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
-
Any endpoint which did not have a tag will be in
cockroachdb_cloud_client.api.default
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cockroachdb_cloud_client-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c065c6e1b673c9098fcde0d83e4bb2fd17cd7b611c41bc0a34be09a6eddd1237 |
|
MD5 | 2d2259596b4131a0cce1d28ce0b483fc |
|
BLAKE2b-256 | 0c12b21fc8db77283c7f4eeb934e6419b9b37f0c4f436e3dca2cd776c828a6f1 |
Close
Hashes for cockroachdb_cloud_client-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80e4e6f41462ba55923dc31f6d86ea562a7977b16e0c892d2db29b0d39ea296c |
|
MD5 | 0808b811adbd1a64bb3598e935785550 |
|
BLAKE2b-256 | 1a2a4653ebadba2e4e600aa46fdc772b315045e5cad58964eea8c973e70a3d44 |