Skip to main content

No project description provided

Project description

derapi

The derapi Python SDK provides access to the Derapi API for Python applications -- fully typed with async support.

The SDK closely mirrors our API, so the API documentation is a helpful reference when using it in your project.

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install derapi

Usage

Client initialization

import os

import httpx
from derapi import AuthenticatedClient

def init_client() -> AuthenticatedClient:
    token_resp = httpx.post(
        "https://auth.derapi.com/oauth2/token",
        auth=(os.environ["DERAPI_CLIENT_ID"], os.environ["DERAPI_CLIENT_SECRET"]),
        data={"grant_type": "client_credentials"},
    )
    token_resp.raise_for_status()
    token = token_resp.json()["access_token"]
    return AuthenticatedClient(
        base_url="https://api.derapi.com",
        raise_on_unexpected_status=True,
        token=token,
    )

Example: Retrieve a list of Sites synchronously, iterating through all pages of results automatically

...

from derapi.api.sites import list_sites

client = init_client()

for site in list_sites.sync_depaginated(client=client):
    print(site.id)

License

derapi is distributed under the terms of the MIT license.

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

derapi-0.1.2.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

derapi-0.1.2-py3-none-any.whl (153.0 kB view details)

Uploaded Python 3

File details

Details for the file derapi-0.1.2.tar.gz.

File metadata

  • Download URL: derapi-0.1.2.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for derapi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c7213d0f7aed9402c2fa52c816298c59ce0902cdd3e8f14d8cf30d7ea1951d83
MD5 4a7b35c8c90d8d5d2eb99826cdb9f9b3
BLAKE2b-256 f0069776f6c54bf5a9f94a299ba4c3a65f9d3312c782c69173befcf54f5ef524

See more details on using hashes here.

Provenance

The following attestation bundles were made for derapi-0.1.2.tar.gz:

Publisher: publish.yaml on derapi/derapi-python

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

File details

Details for the file derapi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: derapi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 153.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for derapi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 435e337dffdaa5222ea665dde20dd5a63c15796d700ed76f7e527e47186b2156
MD5 cdb698e394aa035a40a7ae27d5eadce6
BLAKE2b-256 bf48a0b4f86eb5a016a4019da9faa2ca6123e424131325fa1ae82cc7eef72fdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for derapi-0.1.2-py3-none-any.whl:

Publisher: publish.yaml on derapi/derapi-python

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

Supported by

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