{"id":25553792,"url":"https://github.com/docusign/code-examples-python","last_synced_at":"2025-04-05T21:10:55.292Z","repository":{"id":45557817,"uuid":"158505642","full_name":"docusign/code-examples-python","owner":"docusign","description":"Docusign Python code examples and launcher","archived":false,"fork":false,"pushed_at":"2025-02-06T19:30:24.000Z","size":2452,"stargazers_count":47,"open_issues_count":2,"forks_count":54,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-29T20:09:01.780Z","etag":null,"topics":["authorization-code-grant","click-api","docusign","flask","jwt","monitor-api","python","rooms-api","webforms-api"],"latest_commit_sha":null,"homepage":"https://developers.docusign.com/","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/docusign.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":"2018-11-21T07:07:31.000Z","updated_at":"2025-02-28T01:45:54.000Z","dependencies_parsed_at":"2023-12-28T23:50:13.598Z","dependency_job_id":"fa985da2-b7a9-4851-9e64-cc25493cf210","html_url":"https://github.com/docusign/code-examples-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docusign%2Fcode-examples-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docusign%2Fcode-examples-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docusign%2Fcode-examples-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docusign%2Fcode-examples-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docusign","download_url":"https://codeload.github.com/docusign/code-examples-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399885,"owners_count":20932880,"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":["authorization-code-grant","click-api","docusign","flask","jwt","monitor-api","python","rooms-api","webforms-api"],"created_at":"2025-02-20T12:01:40.763Z","updated_at":"2025-04-05T21:10:55.262Z","avatar_url":"https://github.com/docusign.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Python Launcher Code Examples\n\n\u003e\n\u003e### PLEASE! Share your feedback in a [two-question survey](https://docs.google.com/forms/d/e/1FAIpQLScPa74hwhJwi7XWDDj4-XZVOQTF9jJWgbIFEpulXokCqYWT4A/viewform?usp=pp_url\u0026entry.680551577=Python).\n\u003e\n\u003e\n### GitHub repo: [code-examples-python](./README.md)\n\nThis GitHub repo includes code examples for the [Web Forms API](https://developers.docusign.com/docs/web-forms-api/), [Docusign Admin API](https://developers.docusign.com/docs/admin-api/), [Click API](https://developers.docusign.com/docs/click-api/), [eSignature REST API](https://developers.docusign.com/docs/esign-rest-api/), [Monitor API](https://developers.docusign.com/docs/monitor-api/), and [Rooms API](https://developers.docusign.com/docs/rooms-api/). \n\n\n\n## Introduction\n\nThis repo is a Python 3 application that supports the following authentication workflows:\n\n* Authentication with Docusign via [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode).\nWhen the token expires, the user is asked to re-authenticate. The refresh token is not used.\n\n* Authentication with Docusign via [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/).\nWhen the token expires, it updates automatically.\n\n## eSignature API\n\nFor more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes).  \n\nFor a list of code examples that use the eSignature API, see the [How-to guides overview](https://developers.docusign.com/docs/esign-rest-api/how-to/) on the Docusign Developer Center.\n\n\n## Rooms API \n\n**Note:** To use the Rooms API, you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the Docusign Forms feature enabled in your Rooms for Real Estate account.  \nFor more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/).  \n\nFor a list of code examples that use the Rooms API, see the [How-to guides overview](https://developers.docusign.com/docs/rooms-api/how-to/) on the Docusign Developer Center.\n\n\n## Click API  \nFor more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes)  \n\nFor a list of code examples that use the Click API, see the [How-to guides overview](https://developers.docusign.com/docs/click-api/how-to/) on the Docusign Developer Center.\n\n\n## Monitor API\n\n**Note:** To use the Monitor API, you must also [enable Docusign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/).  \n\nFor information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). \n\nFor a list of code examples that use the Monitor API, see the [How-to guides overview](https://developers.docusign.com/docs/monitor-api/how-to/) on the Docusign Developer Center.\n\n\n## Admin API\n\n**Note:** To use the Admin API, you must [create an organization](https://support.docusign.com/en/guides/org-admin-guide-create-org) in your Docusign developer account. Also, to run the Docusign CLM code example, [CLM must be enabled for your organization](https://support.docusign.com/en/articles/DocuSign-and-SpringCM).\n\nFor information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/).\n\nFor a list of code examples that use the Admin API, see the [How-to guides overview](https://developers.docusign.com/docs/admin-api/how-to/) on the Docusign Developer Center.\n\n\n## Web Forms API\n\nThe Web Forms API is available in all developer accounts, but only in certain production account plans. Contact [Docusign Support](https://support.docusign.com/) or your account manager to find out whether the Web Forms API is available for your production account plan.\n\nFor more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/web-forms-api/plan-integration/authentication/).\n\nFor a list of code examples that use the Web Forms API, see the [How-to guides overview](https://developers.docusign.com/docs/web-forms-api/how-to/) on the Docusign Developer Center.\n\n## Installation\n\n### Prerequisites\n**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the Docusign Developer Center, skip items 1 and 2 as they were automatically performed for you.\n\n1. A free [Docusign developer account](https://go.docusign.com/o/sandbox/); create one if you don't already have one.\n1. A Docusign app and integration key that is configured to use either [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) or [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication.\n\n   This [video](https://www.youtube.com/watch?v=eiRI4fe5HgM) demonstrates how to obtain an integration key.  \n   \n   To use [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/), you will need an integration key and a secret key. See [Installation steps](#installation-steps) for details.  \n\n   To use [JWT Grant](https://developers.docusign.com/platform/auth/jwt/), you will need an integration key, an RSA key pair, and the User ID GUID of the impersonated user. See [Installation steps for JWT Grant authentication](#installation-steps-for-jwt-grant-authentication) for details.  \n\n   For both authentication flows:  \n   \n   If you use this launcher on your own workstation, the integration key must include a redirect URI of http://localhost:3000/ds/callback\n\n   If you host this launcher on a remote web server, set your redirect URI as   \n   \n   {base_url}/ds/callback\n   \n   where {base_url} is the URL for the web app.\n\n1. Python 3.\n1. If you are working on a Windows with a Python version after 3.10 you will also need to install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022). After installing that run `pip install --upgrade setuptools`.\n\n### Installation steps\n\n**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the Docusign Developer Center, skip step 4 as it was automatically performed for you.\n\n1. Extract the Quickstart ZIP file or download or clone the code-examples-python repository.\n1. In your command-line environment, switch to the folder:  \n   `cd \u003cQuickstart folder\u003e` or `cd code-examples-python`\n1. To install dependencies, run: `pip3 install -r requirements.txt`  (or pipenv can be used)\n1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file app/ds_config_sample.py and save the copy as app/ds_config.py.\n   1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions \u003e Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in ds_config.py as your `ds_client_id`.\n   1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in ds_config.py as your `ds_client_secret`.\n   1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:3000/ds/callback. Select **SAVE**.   \n   1. Set a name and email address for the signer. In ds_config.py, save an email address as `signer_email` and a name as `signer_name`.  \n**Note:** Protect your personal information. Please make sure that ds_config.py will not be stored in your source code repository.\n1. Run the launcher:`python run.py`  \n   **Note:** You will need to alias the python command to run Python 3 or use `python3 run.py`\n1. Open a browser to http://localhost:3000\n\n### Installation steps with docker\n\n**Note**: Running the launcher with docker will use Python 3.11\n\n1. Open the Docker application\n1. `docker image build -t docusign .`\n1. `docker run --name docusign_python -p 3000:3000 -d docusign`\n1. Open a browser to http://localhost:3000\n\n### Installation steps for JWT Grant authentication\n\n**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the Docusign Developer Center, skip step 4 as it was automatically performed for you.  \nAlso, in order to select JSON Web Token authentication in the launcher, in app/ds_config.py, change the `quickstart` setting to `\"false\"`.\n\n1. Extract the Quickstart ZIP file or download or clone the code-examples-python repository.\n1. In your command-line environment, switch to the folder: `cd \u003cQuickstart folder\u003e` or `cd code-examples-python`\n1. To install dependencies, run: `pip3 install -r requirements.txt`  (or pipenv can be used)\n1. To configure the launcher for [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication, create a copy of the file app/ds_config_sample.py and save the copy as app/ds_config.py.\n   1. Add your User ID. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **User ID** GUID and save it in ds_config.py as your `ds_impersonated_user_id`.\n   1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions \u003e Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in ds_config.py as your `ds_client_id`.\n   1. Generate an RSA key pair, if you don’t already have one. Under **Authentication**, select **+ GENERATE RSA**. Copy the private key, and save it in a new file named app/private.key.   \n   1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:3000/ds/callback. Select **SAVE**.   \n   1. Set a name and email address for the signer. In ds_config.py, save an email address as `signer_email` and a name as `signer_name`.  \n**Note:** Protect your personal information. Please make sure that your ds_config.py and private.key files will not be stored in your source code repository.  \n1. Run the launcher:`python run.py`  \n   **Note:** You will need to alias the python command to run Python 3 or use `python3 run.py`   \n1. Open a browser to http://localhost:3000\n1. On the black navigation bar, select **Login**.\n1. From the picklist, select **JSON Web Token** \u003e **Authenticate with Docusign**.\n1. When prompted, log in to your Docusign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. \n1. Select your desired code example.\n\n\n## JWT grant remote signing and Authorization Code Grant embedded signing projects\n\nSee [Docusign Quickstart overview](https://developers.docusign.com/docs/esign-rest-api/quickstart/overview/) on the Docusign Developer Center for more information on how to run the JWT grant remote signing project and the Authorization Code Grant embedded signing project.\n\n### Installation steps for JWT grant remote signing example\n\nFollow the instructions below if you downloaded the JWT grant remote signing example.\n\n1. Extract the Quickstart ZIP file or download or clone the code-examples-python repository.\n1. Run the JWT console project: `python jwt_console.py`. If you do not already have the docusign-esign package, it will be \n   installed for you when you start the project.\n  **Note:** You will need to alias the python command to run Python 3 or use `python3 run.py`\n1. Follow the prompts from the command line to grant consent in your browser.\n1. Return to the command line and follow the prompts to enter the names and email addresses of your recipients.\n1. Check your email to sign the example document.\n\n\n## Payments code example  \n\nTo use the payments code example, create a test payment gateway on the [Payments](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details.\n\nOnce you've created a payment gateway, save the **Gateway Account ID** GUID to ds_config.py.\n\n\n## License and additional information  \n\n### License  \nThis repository uses the MIT License. See [LICENSE](./LICENSE) for details.\n\n### Pull Requests\nPull requests are welcomed. Pull requests will only be considered if their content\nuses the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocusign%2Fcode-examples-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocusign%2Fcode-examples-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocusign%2Fcode-examples-python/lists"}