Skip to main content

A python wrapper for the Dialpad REST API

Project description

Python Dialpad API Client

A python wrapper around the Dialpad REST API

This document describes the installation, usage, and development practices of this python library. For information about the API itself, head on over to our API Documentation page!

Installation

Just use everyone's new favourite python package manager: uv

uv add python-dialpad

Usage

The Short Version

TL;DR, this library provides a DialpadClient class, which can be instantiated with an API token and a dialpad URL.

Once a DialpadClient object has been constructed, it can be used to call our API endpoints:

from dialpad import DialpadClient

dp_client = DialpadClient(sandbox=True, token='API_TOKEN_HERE')

print(dp_client.users.get(user_id='1234567'))

Client Constructor Arguments

  • token (required) The API token that will be used to authenticate API requests.
  • sandbox (optional) If the sandbox argument is set to True, then API calls will be routed to https://sandbox.dialpad.com.
  • base_url (optional) Routes requests to a specific url.

API Resources

In general, resources that we support in our public API will be exposed as properties of the client object. For example, the User resource can be accessed using the users property (as demonstrated above).

Each of these resource properties will expose related HTTP methods as methods of that resource property.

For example, GET /api/v2/users/{id} translates to dp_client.users.get('a_user_id').

When in doubt, type annotations and docstrings are sourced directly from the Dialpad API spec, and should behave well with most editors' autocomplete/tooltip features: user list method tooltip

API Responses

In cases where our API responds with a single JSON object, the client method will return a Python dict (as demonstrated above)

In cases where our API responds with a paginated list of many JSON objects, the client method will return an iterator which will lazily request the next page as the iterator is iterated upon.

from dialpad import DialpadClient

dp_client = DialpadClient(sandbox=True, token='API_TOKEN_HERE')

for user in dp_client.users.list():
  print(user)

Async Support

AsyncDialpadClient is a thing now 🌈

from dialpad import AsyncDialpadClient

dp_client = AsyncDialpadClient(sandbox=True, token='API_TOKEN_HERE')

async for user in dp_client.users.list():
  print(user)

Development

This project is now managed with uv, and exposes a cli tool to automate most maintenance tasks. uv run cli --help for details.

Maintenance Releases

Changes/additions to the Dialpad API can be handled (mostly) automatically 👍

Update Procedure

  • Run uv run cli interactive-update

This will take care of pulling down the latest OAS from dialpad.com, updating the client accordingly, and bumping the package version number.

  • Run uv run pytest

    • Never hurts to confirm that nothing got borked 👍
  • Commit the changes, tag the commit, and push up the changes

    • interactive-update provides these in its output for convenience 👍

Pushing up a version tag will trigger GHA to build, test, and publish to PyPI 🍻

Feature Releases

The schema and resource classes in this project are now automatically-generated, but the rest of the project files can still be directly edited to add features or extend functionality

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

python_dialpad-3.1.0.tar.gz (354.3 kB view details)

Uploaded Source

Built Distribution

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

python_dialpad-3.1.0-py3-none-any.whl (143.2 kB view details)

Uploaded Python 3

File details

Details for the file python_dialpad-3.1.0.tar.gz.

File metadata

  • Download URL: python_dialpad-3.1.0.tar.gz
  • Upload date:
  • Size: 354.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for python_dialpad-3.1.0.tar.gz
Algorithm Hash digest
SHA256 f866f6b33ef8960e5112f23817b62ae74d4cb906672b350b54da35c38dbd4b94
MD5 2055aa4dce1c5989426a9c6a173229f7
BLAKE2b-256 1f9baebd57566ae35ade04335beaed9e230f4d8a09ff6726a1c1b7cd968bcb19

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_dialpad-3.1.0.tar.gz:

Publisher: publish.yml on dialpad/dialpad-python-sdk

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

File details

Details for the file python_dialpad-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_dialpad-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 143.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for python_dialpad-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a57093d102a40c02e1fd820155276ae6fad46cf713ebf4c7d578c69f3c49ad63
MD5 17ee33dcd8892fe67e57a59369e86f07
BLAKE2b-256 2b8a30f72d40dd53fc98b7f53aee0bd2a71ff75b1c836db781d24b0b7279b55c

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_dialpad-3.1.0-py3-none-any.whl:

Publisher: publish.yml on dialpad/dialpad-python-sdk

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