{"id":24746737,"url":"https://github.com/documenso/sdk-python","last_synced_at":"2025-03-23T01:24:05.503Z","repository":{"id":274568431,"uuid":"919437751","full_name":"documenso/sdk-python","owner":"documenso","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-07T05:11:26.000Z","size":538,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-07T06:20:35.882Z","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/documenso.png","metadata":{"files":{"readme":"README-PYPI.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2025-01-20T11:44:56.000Z","updated_at":"2025-03-07T05:11:30.000Z","dependencies_parsed_at":"2025-03-07T06:29:52.536Z","dependency_job_id":null,"html_url":"https://github.com/documenso/sdk-python","commit_stats":null,"previous_names":["documenso/sdk-python"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documenso%2Fsdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documenso%2Fsdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documenso%2Fsdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documenso%2Fsdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/documenso","download_url":"https://codeload.github.com/documenso/sdk-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245042243,"owners_count":20551545,"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":"2025-01-28T04:32:31.680Z","updated_at":"2025-03-23T01:24:05.493Z","avatar_url":"https://github.com/documenso.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/documenso/documenso/assets/13398220/a643571f-0239-46a6-a73e-6bef38d1228b\" alt=\"Documenso Logo\"\u003e\n\n\u0026nbsp;\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://www.speakeasy.com/?utm_source=documenso-sdk\u0026utm_campaign=python\"\u003e\u003cimg src=\"https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge\u0026logoColor=FBE331\u0026logo=speakeasy\u0026labelColor=545454\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" style=\"width: 100px; height: 28px;\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n## Documenso Python SDK\n\nA SDK for seamless integration with Documenso v2 API.\n\nThe full Documenso API can be viewed here (**todo**), which includes examples.\n\n## ⚠️ Warning\n\nDocumenso v2 API and SDKs are currently in beta. There may be to breaking changes.\n\nTo keep updated, please follow the discussions and issues here:\n- Discussion -\u003e Todo\n- Breaking change alerts -\u003e Todo\n\u003c!-- No Summary [summary] --\u003e\n\n## Table of Contents\n\u003c!-- $toc-max-depth=2 --\u003e\n* [Overview](https://github.com/documenso/sdk-python/blob/master/#documenso-python-sdk)\n  * [SDK Installation](https://github.com/documenso/sdk-python/blob/master/#sdk-installation)\n  * [IDE Support](https://github.com/documenso/sdk-python/blob/master/#ide-support)\n  * [Authentication](https://github.com/documenso/sdk-python/blob/master/#authentication)\n  * [Document creation example](https://github.com/documenso/sdk-python/blob/master/#document-creation-example)\n  * [Available Resources and Operations](https://github.com/documenso/sdk-python/blob/master/#available-resources-and-operations)\n  * [Retries](https://github.com/documenso/sdk-python/blob/master/#retries)\n  * [Error Handling](https://github.com/documenso/sdk-python/blob/master/#error-handling)\n  * [Debugging](https://github.com/documenso/sdk-python/blob/master/#debugging)\n* [Development](https://github.com/documenso/sdk-python/blob/master/#development)\n  * [Maturity](https://github.com/documenso/sdk-python/blob/master/#maturity)\n  * [Contributions](https://github.com/documenso/sdk-python/blob/master/#contributions)\n\n\u003c!-- No Table of Contents [toc] --\u003e\n\n\u003c!-- Start SDK Installation [installation] --\u003e\n## SDK Installation\n\n\u003e [!TIP]\n\u003e To finish publishing your SDK to PyPI you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).\n\n\n\u003e [!NOTE]\n\u003e **Python version upgrade policy**\n\u003e\n\u003e Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.\n\nThe SDK can be installed with either *pip* or *poetry* package managers.\n\n### PIP\n\n*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.\n\n```bash\npip install git+https://github.com/documenso/sdk-python.git\n```\n\n### Poetry\n\n*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.\n\n```bash\npoetry add git+https://github.com/documenso/sdk-python.git\n```\n\n### Shell and script usage with `uv`\n\nYou can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:\n\n```shell\nuvx --from documenso_sdk python\n```\n\nIt's also possible to write a standalone Python script without needing to set up a whole project like so:\n\n```python\n#!/usr/bin/env -S uv run --script\n# /// script\n# requires-python = \"\u003e=3.9\"\n# dependencies = [\n#     \"documenso_sdk\",\n# ]\n# ///\n\nfrom documenso_sdk import Documenso\n\nsdk = Documenso(\n  # SDK arguments\n)\n\n# Rest of script here...\n```\n\nOnce that is saved to a file, you can run it with `uv run script.py` where\n`script.py` can be replaced with the actual file name.\n\u003c!-- End SDK Installation [installation] --\u003e\n\n\u003c!-- Start IDE Support [idesupport] --\u003e\n## IDE Support\n\n### PyCharm\n\nGenerally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.\n\n- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)\n\u003c!-- End IDE Support [idesupport] --\u003e\n\n## Authentication\n\nTo use the SDK, you will need a Documenso API key which can be created [here](https://docs.documenso.com/developers/public-api/authentication#creating-an-api-key\n).\n\n```python\nimport documenso_sdk\nfrom documenso_sdk import Documenso\nimport os\n\nwith Documenso(\n    api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n) as documenso:\n```\n\u003c!-- No Authentication [security] --\u003e\n\n## Document creation example\n\nCurrently creating a document involves two steps:\n\n1. Create the document\n2. Upload the PDF\n\nThis is a temporary measure, in the near future prior to the full release we will merge these two tasks into one request. \n\nHere is a full example of the document creation process which you can copy and run.\n\nNote that the function is temporarily called `createV0`, which will be replaced by `create` once we resolve the 2 step workaround.\n\n```python\n# Todo\n```\n\u003c!-- No SDK Example Usage [usage] --\u003e\n\n\u003c!-- Start Available Resources and Operations [operations] --\u003e\n## Available Resources and Operations\n\n\u003cdetails open\u003e\n\u003csummary\u003eAvailable methods\u003c/summary\u003e\n\n\n### [documents](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md)\n\n* [find](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#find) - Find documents\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#get) - Get document\n* [create_v0](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#create_v0) - Create document\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#update) - Update document\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#delete) - Delete document\n* [move_to_team](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#move_to_team) - Move document\n* [distribute](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#distribute) - Distribute document\n* [redistribute](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#redistribute) - Redistribute document\n* [duplicate](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documents/README.md#duplicate) - Duplicate document\n\n#### [documents.fields](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md)\n\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#get) - Get document field\n* [create](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#create) - Create document field\n* [create_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#create_many) - Create document fields\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#update) - Update document field\n* [update_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#update_many) - Update document fields\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/fields/README.md#delete) - Delete document field\n\n#### [documents.recipients](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md)\n\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#get) - Get document recipient\n* [create](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#create) - Create document recipient\n* [create_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#create_many) - Create document recipients\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#update) - Update document recipient\n* [update_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#update_many) - Update document recipients\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/recipients/README.md#delete) - Delete document recipient\n\n### [templates](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md)\n\n* [find](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#find) - Find templates\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#get) - Get template\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#update) - Update template\n* [duplicate](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#duplicate) - Duplicate template\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#delete) - Delete template\n* [use](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#use) - Use template\n* [move_to_team](https://github.com/documenso/sdk-python/blob/master/docs/sdks/templates/README.md#move_to_team) - Move template\n\n#### [templates.direct_link](https://github.com/documenso/sdk-python/blob/master/docs/sdks/directlink/README.md)\n\n* [create](https://github.com/documenso/sdk-python/blob/master/docs/sdks/directlink/README.md#create) - Create direct link\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/directlink/README.md#delete) - Delete direct link\n* [toggle](https://github.com/documenso/sdk-python/blob/master/docs/sdks/directlink/README.md#toggle) - Toggle direct link\n\n#### [templates.fields](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md)\n\n* [create](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#create) - Create template field\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#get) - Get template field\n* [create_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#create_many) - Create template fields\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#update) - Update template field\n* [update_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#update_many) - Update template fields\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensofields/README.md#delete) - Delete template field\n\n#### [templates.recipients](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md)\n\n* [get](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#get) - Get template recipient\n* [create](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#create) - Create template recipient\n* [create_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#create_many) - Create template recipients\n* [update](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#update) - Update template recipient\n* [update_many](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#update_many) - Update template recipients\n* [delete](https://github.com/documenso/sdk-python/blob/master/docs/sdks/documensorecipients/README.md#delete) - Delete template recipient\n\n\u003c/details\u003e\n\u003c!-- End Available Resources and Operations [operations] --\u003e\n\n\u003c!-- Start Retries [retries] --\u003e\n## Retries\n\nSome of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:\n```python\nfrom documenso_sdk import Documenso\nfrom documenso_sdk.utils import BackoffStrategy, RetryConfig\nimport os\n\nwith Documenso(\n    api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n) as documenso:\n\n    res = documenso.documents.find(,\n        RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False))\n\n    # Handle response\n    print(res)\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:\n```python\nfrom documenso_sdk import Documenso\nfrom documenso_sdk.utils import BackoffStrategy, RetryConfig\nimport os\n\nwith Documenso(\n    retry_config=RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False),\n    api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n) as documenso:\n\n    res = documenso.documents.find()\n\n    # Handle response\n    print(res)\n\n```\n\u003c!-- End Retries [retries] --\u003e\n\n\u003c!-- Start Error Handling [errors] --\u003e\n## Error Handling\n\nHandling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.\n\nBy default, an API error will raise a models.APIError exception, which has the following properties:\n\n| Property        | Type             | Description           |\n|-----------------|------------------|-----------------------|\n| `.status_code`  | *int*            | The HTTP status code  |\n| `.message`      | *str*            | The error message     |\n| `.raw_response` | *httpx.Response* | The raw HTTP response |\n| `.body`         | *str*            | The response content  |\n\nWhen custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `find_async` method may raise the following exceptions:\n\n| Error Type                                                   | Status Code | Content Type     |\n| ------------------------------------------------------------ | ----------- | ---------------- |\n| models.DocumentFindDocumentsDocumentsResponseBody            | 400         | application/json |\n| models.DocumentFindDocumentsDocumentsResponseResponseBody    | 404         | application/json |\n| models.DocumentFindDocumentsDocumentsResponse500ResponseBody | 500         | application/json |\n| models.APIError                                              | 4XX, 5XX    | \\*/\\*            |\n\n### Example\n\n```python\nfrom documenso_sdk import Documenso, models\nimport os\n\nwith Documenso(\n    api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n) as documenso:\n    res = None\n    try:\n\n        res = documenso.documents.find()\n\n        # Handle response\n        print(res)\n\n    except models.DocumentFindDocumentsDocumentsResponseBody as e:\n        # handle e.data: models.DocumentFindDocumentsDocumentsResponseBodyData\n        raise(e)\n    except models.DocumentFindDocumentsDocumentsResponseResponseBody as e:\n        # handle e.data: models.DocumentFindDocumentsDocumentsResponseResponseBodyData\n        raise(e)\n    except models.DocumentFindDocumentsDocumentsResponse500ResponseBody as e:\n        # handle e.data: models.DocumentFindDocumentsDocumentsResponse500ResponseBodyData\n        raise(e)\n    except models.APIError as e:\n        # handle exception\n        raise(e)\n```\n\u003c!-- End Error Handling [errors] --\u003e\n\n\u003c!-- No Server Selection [server] --\u003e\n\u003c!-- No Custom HTTP Client [http-client] --\u003e\n\n\u003c!-- Start Resource Management [resource-management] --\u003e\n## Resource Management\n\nThe `Documenso` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.\n\n[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers\n\n```python\nfrom documenso_sdk import Documenso\nimport os\ndef main():\n    with Documenso(\n        api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n    ) as documenso:\n        # Rest of application here...\n\n\n# Or when using async:\nasync def amain():\n    async with Documenso(\n        api_key=os.getenv(\"DOCUMENSO_API_KEY\", \"\"),\n    ) as documenso:\n        # Rest of application here...\n```\n\u003c!-- End Resource Management [resource-management] --\u003e\n\n\u003c!-- Start Debugging [debug] --\u003e\n## Debugging\n\nYou can setup your SDK to emit debug logs for SDK requests and responses.\n\nYou can pass your own logger class directly into your SDK.\n```python\nfrom documenso_sdk import Documenso\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG)\ns = Documenso(debug_logger=logging.getLogger(\"documenso_sdk\"))\n```\n\nYou can also enable a default debug logger by setting an environment variable `DOCUMENSO_DEBUG` to true.\n\u003c!-- End Debugging [debug] --\u003e\n\n\u003c!-- Placeholder for Future Speakeasy SDK Sections --\u003e\n\n# Development\n\n## Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. \nWe look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. \n\n### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=documenso-sdk\u0026utm_campaign=python)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocumenso%2Fsdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocumenso%2Fsdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocumenso%2Fsdk-python/lists"}