Skip to main content

A client library for accessing Open Spanner API

Project description

open-spanner

Python client for the Open Spanner API.

Install from PyPI:

pip install open-spanner

Create a meter, then record usage:

from datetime import UTC, datetime
from uuid import uuid4

from open_spanner_client import Client
from open_spanner_client.api.meters import create_meter
from open_spanner_client.api.usages import create_usage
from open_spanner_client.models.meter_create_request import MeterCreateRequest
from open_spanner_client.models.usage_create_request import UsageCreateRequest

client = Client(base_url="https://api.example.com", raise_on_unexpected_status=True)

meter = create_meter.sync(
    client=client,
    body=MeterCreateRequest(
        name="api_requests",
        description="API request counter",
        unit="request",
        aggregation="sum",
        event_retention_days=30,
    ),
)

usage = create_usage.sync(
    client=client,
    body=UsageCreateRequest(
        idempotency_key=str(uuid4()),
        subject="org_123",
        meter=meter.name,
        quantity=1,
        timestamp=datetime.now(UTC).isoformat(),
    ),
)

print(meter.id, usage.id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_spanner-0.1.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_spanner-0.1.1-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file open_spanner-0.1.1.tar.gz.

File metadata

  • Download URL: open_spanner-0.1.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for open_spanner-0.1.1.tar.gz
Algorithm Hash digest
SHA256 468853095c513fff51fd100d3bb79fdc564aecb680c937d8b68d88ba17224439
MD5 5998bf5099c414b70a66414f6a2a998b
BLAKE2b-256 b13fba89fd830e40f6f2370b7e712da4cc3a2c641869e5a3a2b7737c28823f6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_spanner-0.1.1.tar.gz:

Publisher: publish-python-sdk.yml on ssubedir/open-spanner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_spanner-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: open_spanner-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for open_spanner-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92bf05a4aff9d1b1d995178e821e0b45caa432ea558ee6c18200a33d43beedfc
MD5 6155702e4097864179ab6f4548cea231
BLAKE2b-256 772ccc86d418c226a6443b670a569faa1310d1ee43466a1fa5f1e86446b73285

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_spanner-0.1.1-py3-none-any.whl:

Publisher: publish-python-sdk.yml on ssubedir/open-spanner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page