{"id":22683771,"url":"https://github.com/dialpad/dialpad-python-sdk","last_synced_at":"2025-04-12T18:30:34.831Z","repository":{"id":37052115,"uuid":"281235803","full_name":"dialpad/dialpad-python-sdk","owner":"dialpad","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-25T18:39:48.000Z","size":105,"stargazers_count":8,"open_issues_count":9,"forks_count":9,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-03-15T12:11:00.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dialpad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-20T22:09:57.000Z","updated_at":"2023-12-05T01:50:30.000Z","dependencies_parsed_at":"2024-11-06T21:35:02.730Z","dependency_job_id":null,"html_url":"https://github.com/dialpad/dialpad-python-sdk","commit_stats":{"total_commits":81,"total_committers":5,"mean_commits":16.2,"dds":"0.32098765432098764","last_synced_commit":"08a662e265a27aa282c2aaa1bb4428b853f7d8a2"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialpad%2Fdialpad-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialpad%2Fdialpad-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialpad%2Fdialpad-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dialpad%2Fdialpad-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dialpad","download_url":"https://codeload.github.com/dialpad/dialpad-python-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248613097,"owners_count":21133439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T21:13:47.915Z","updated_at":"2025-04-12T18:30:34.789Z","avatar_url":"https://github.com/dialpad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Dialpad API Client\n\nA python wrapper around the Dialpad REST API\n\nThis document describes the installation, usage, and development practices of this python library.\nFor information about the API itself, head on over to our\n[API Documentation](https://developers.dialpad.com/reference) page!\n\n\n## Installation\n\nJust use everyone's favourite python package installer: `pip`\n\n```bash\npip install python-dialpad\n```\n\n## Usage\n\n### The Short Version\n\nTL;DR, this library provides a `DialpadClient` class, which can be instantiated with an API token\nand a dialpad URL.\n\nOnce a `DialpadClient` object has been constructed, it can be used to call our API endpoints:\n\n```python\nfrom dialpad import DialpadClient\n\ndp_client = DialpadClient(sandbox=True, token='API_TOKEN_HERE')\n\nprint(dp_client.user.get(user_id='1234567'))\n```\n\n### Client Constructor Arguments\n\n- `token (required)` The API token that will be used to authenticate API requests.\n- `sandbox (optional)` If the `sandbox` argument is set to `True`, then API calls will be\n  routed to `https://sandbox.dialpad.com`.\n- `base_url (optional)` Routes requests to a specific url.\n\n\n### API Resources\n\nIn general, each resource that we support in our public API will be exposed as properties of the\nclient object. For example, the `User` resource can be accessed using the `user` property (as\ndemonstrated above).\n\nEach of these resource properties will expose related HTTP methods as methods of that resource\nproperty.\n\nFor example, `GET /api/v2/users/{id}` translates to `dp_client.user.get('the_user_id')`.\n\n\n### API Responses\n\nIn cases where our API responds with a single JSON object, the client method will return a Python\ndict (as demonstrated above)\n\nIn cases where our API responds with a paginated list of many JSON objects, the client method will\nreturn an iterator which will lazily request the next page as the iterator is iterated upon.\n\n```python\nfrom dialpad import DialpadClient\n\ndp_client = DialpadClient(sandbox=True, token='API_TOKEN_HERE')\n\nfor user in dp_client.user.list():\n  print(user)\n```\n\n\n## Development\n\n### Testing\n\nThat's right, the testing section is first in line! Before you start diving in, let's just make sure your environment is set up properly, and that the tests are running buttery-smooth.\n\nAssuming you've already cloned the repository, all you'll need to do is install `tox`, and run the command against the appropriate environment.\n\n* Install the `tox` package.\n  ```shell\n  $ pip install tox\n  ```\n\n* Run the tests\n  ```shell\n  $ tox\n  ```\n  Optionaly, you can specify an environment to run the tests against. For eg:\n  ```shell\n  $ tox -e py3\n  ```\nThat was easy :)\n\nNeato!\n\n### Adding New Resources\n\nMost of the changes to this library will probably just be adding support for additional resources\nand endpoints that we expose in the API, so let's start with how to add a new resource.\n\nEach resource exposed by this library should have its own python file under the `dialpad/resources`\ndirectory, and should define a single `class` that inherits from `DialpadResource`.\n\nThe class itself should set the `_resource_path` class property to a list of strings such\nthat `'/api/v2/' + '/'.join(_resource_path)` corresponds to the API path for that resource.\n\nOnce the `_resource_path` is defined, the resource class can define instance methods to expose\nfunctionality related to the resource that it represents, and can use the `self.request` helper\nmethod to make authenticated requests to API paths under the `_resource_path`. For example,\nif `_resource_path` is set to `['users']`, then calling `self.request(method='POST')` would make\na `POST` request to `/api/v2/users`. (A more precise description of the `request` method is given\nin the following section)\n\nWith that in mind, most methods that the developer chooses to add to a resource class will probably\njust be a very thin method that passes the appropriate arguments into `self.request`, and returns\nthe result.\n\n\n#### The `request` Helper Method\n\n`self.request` is a helper method that handles the details of authentication, response parsing, and\npagination, such that the caller only needs to specify the API path, HTTP method, and request data.\nThe method arguments are as follows:\n\n- `path (optional)` Any additional path elements that should be added after the `_resource_path`\n- `method (optional, default: 'GET')` The HTTP method\n- `data (optional)` A python dict defining either the query params or the JSON payload, depending on\n  which HTTP method is specified\n- `headers (optional)` Any additional headers that should be included in the request (the API key\n  is automatically included)\n\nIf the request succeeds, then `self.request` will either return a python dict, or an iterator of\npython dicts, depending on whether the server responds with a pagenated response. Pagenated\nresponses will be detected automatically, so the caller does not need to worry about it.\n\nIf the request fails, then a `requests.HTTPError` exception will be raised, and it'll be up to the\nconsumer of this library to deal with it 😎\n\n\n#### The `resources/__init__.py` File\n\nWhen a new file is added to the `resources` directory, a new import statement should also be added\nto `__init__.py` to expose the newly defined resource class as a direct property of the `resources`\nmodule.\n\n\n#### `DialpadClient` Resource Properties\n\nIn addition to adding the new class to the `__init__.py` file, the new resource class should also\nbe added as a cached property of the `DialpadClient` class.\n\n\n#### Recap\n\nTo add a new resource to this client library, simply:\n- Create a new file under the `resources` directory\n- Define a new subclass of `DialpadResource` within said file\n- Expose methods related to that resource as methods on your new class\n- Add a new import statement in `resources/__init__.py`\n- Add a new property to the `DialpadClient` class\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialpad%2Fdialpad-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdialpad%2Fdialpad-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdialpad%2Fdialpad-python-sdk/lists"}