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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5e5d318481d625d7e504ea3d6f82a0aa96434f17fc3337fd5a8b69cf0b54eee |
|
MD5 | 52eec55428998e36c5b3cfd7ec1190dd |
|
BLAKE2b-256 | 28a4f7c699a6f0b3f47d8355affa5e49901dc4f093d49588e207621963a78ee7 |
Close
Hashes for cockroachdb_cloud_client-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2136272ac00f1193cd388c6a57d9fcd7479ea876af4483e89e7191d6cf7cf11c |
|
MD5 | 31b3fe38aa4bf56cdca0c52cc9334d96 |
|
BLAKE2b-256 | 1a214731642194b2dc0fd95d85e966e8fff83ec96ffcdde1831e5325cb98fdc3 |