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.2.0.tar.gz (354.9 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.2.0-py3-none-any.whl (145.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for python_dialpad-3.2.0.tar.gz
Algorithm Hash digest
SHA256 05fa07fdc8d031576fbebd25724ef28bddaa12a32ca658b1154b52d42db27602
MD5 bb6e25b3827854720a3aad494d7b729f
BLAKE2b-256 e9c89b69e0234f5261d43b0e9d789afbb096f48a97d9a3a5b086f241f3378ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_dialpad-3.2.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.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for python_dialpad-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 595287e1a0cbae3aa66040589df225aa3c0994ed921534aa581ff1d452cf8adc
MD5 36e42dc0b06a72fe07d33489c2d0d1fc
BLAKE2b-256 f927f2c457aa3fdb46bfce7afe2cebe2c0c2f5cdce05f0856859d97260d9882c

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_dialpad-3.2.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