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.1.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

derapi-0.1.1-py3-none-any.whl (152.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: derapi-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 38544b865bed78f22966816f04b3f98ed97cacddf36acdc8f88c3887644ddb45
MD5 df34b3df1c1a0b993d9386959935bc6f
BLAKE2b-256 d3e284329a49c0a09b72e4771e816be814fe111ed1ee02233b7c76a5b8230872

See more details on using hashes here.

Provenance

The following attestation bundles were made for derapi-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: derapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 152.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0955a30f1ff774becb405f9dadb857759a0f12121bc8988bb397ca5f888678a
MD5 1ba9547ecf66c7c27b24cb6574dca93a
BLAKE2b-256 333508986cb5edecca42680f93a25714a51079993baaee56c0a8cf5a75c5b173

See more details on using hashes here.

Provenance

The following attestation bundles were made for derapi-0.1.1-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 Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page