Skip to content

Repository files navigation

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 - VersionPyPI - Python Version


Table of Contents

Installation

pip install derapi

Usage

Client initialization

importosimporthttpxfromderapiimportAuthenticatedClientdefinit_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"]
returnAuthenticatedClient(
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

...
fromderapi.api.sitesimportlist_sitesclient=init_client()
forsiteinlist_sites.sync_depaginated(client=client):
print(site.id)

License

derapi is distributed under the terms of the MIT license.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages