- Notifications
You must be signed in to change notification settings - Fork0
Docusign Python code examples and launcher
License
danielhusar/code-examples-python
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
GitHub repo:code-examples-python
This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. By default, the launcher will display the eSignature examples. To switch between API code examples, select "Choose API" in the top menu.
This repo is a Python 3 application that supports the following authentication workflows:
Authentication with Docusign viaAuthorization Code Grant.When the token expires, the user is asked to re-authenticate. The refresh token is not used.
Authentication with Docusign viaJSON Web Token (JWT) Grant.When the token expires, it updates automatically.
For more information about the scopes used for obtaining authorization to use the eSignature API, seeRequired scopes.
For a list of code examples that use the eSignature API, see theHow-to guides overview on the Docusign Developer Center.
Note: To use the Rooms API, you must alsocreate your Rooms developer account. Examples 4 and 6 require that you have the Docusign Forms feature enabled in your Rooms for Real Estate account.
For more information about the scopes used for obtaining authorization to use the Rooms API, seeRequired scopes.
For a list of code examples that use the Rooms API, see theHow-to guides overview on the Docusign Developer Center.
For more information about the scopes used for obtaining authorization to use the Click API, seeRequired scopes
For a list of code examples that use the Click API, see theHow-to guides overview on the Docusign Developer Center.
Note: To use the Monitor API, you must alsoenable Docusign Monitor for your organization.
For information about the scopes used for obtaining authorization to use the Monitor API, see thescopes section.
For a list of code examples that use the Monitor API, see theHow-to guides overview on the Docusign Developer Center.
Note: To use the Admin API, you mustcreate an organization in your Docusign developer account. Also, to run the Docusign CLM code example,CLM must be enabled for your organization.
For information about the scopes used for obtaining authorization to use the Admin API, see thescopes section.
For a list of code examples that use the Admin API, see theHow-to guides overview on the Docusign Developer Center.
The Web Forms API is available in all developer accounts, but only in certain production account plans. ContactDocusign Support or your account manager to find out whether the Web Forms API is available for your production account plan.
For more information about the scopes used for obtaining authorization to use the Rooms API, seeRequired scopes.
For a list of code examples that use the Web Forms API, see theHow-to guides overview on the Docusign Developer Center.
Note: If you downloaded this code usingQuickstart from the Docusign Developer Center, skip items 1 and 2 as they were automatically performed for you.
A freeDocusign developer account; create one if you don't already have one.
A Docusign app and integration key that is configured to use eitherAuthorization Code Grant orJWT Grant authentication.
Thisvideo demonstrates how to obtain an integration key.
To useAuthorization Code Grant, you will need an integration key and a secret key. SeeInstallation steps for details.
To useJWT Grant, you will need an integration key, an RSA key pair, and the User ID GUID of the impersonated user. SeeInstallation steps for JWT Grant authentication for details.
For both authentication flows:
If you use this launcher on your own workstation, the integration key must include a redirect URI ofhttp://localhost:3000/ds/callback
If you host this launcher on a remote web server, set your redirect URI as
{base_url}/ds/callback
where {base_url} is the URL for the web app.
Python 3.
If you are working on a Windows with a Python version after 3.10 you will also need to installMicrosoft C++ Build Tools. After installing that run
pip install --upgrade setuptools.
Note: If you downloaded this code usingQuickstart from the Docusign Developer Center, skip step 4 as it was automatically performed for you.
- Extract the Quickstart ZIP file or download or clone the code-examples-python repository.
- In your command-line environment, switch to the folder:
cd <Quickstart folder>orcd code-examples-python - To install dependencies, run:
pip3 install -r requirements.txt(or pipenv can be used) - To configure the launcher forAuthorization Code Grant authentication, create a copy of the file app/ds_config_sample.py and save the copy as app/ds_config.py.
- Add your integration key. On theApps and Keys page, underApps and Integration Keys, choose the app to use, then selectActions > Edit. UnderGeneral Info, copy theIntegration Key GUID and save it in ds_config.py as your
ds_client_id. - Generate a secret key, if you don’t already have one. UnderAuthentication, select+ ADD SECRET KEY. Copy the secret key and save it in ds_config.py as your
ds_client_secret. - Add the launcher’s redirect URI. UnderAdditional settings, select+ ADD URI, and set a redirect URI ofhttp://localhost:3000/ds/callback. SelectSAVE.
- Set a name and email address for the signer. In ds_config.py, save an email address as
signer_emailand a name assigner_name.
Note: Protect your personal information. Please make sure that ds_config.py will not be stored in your source code repository.
- Add your integration key. On theApps and Keys page, underApps and Integration Keys, choose the app to use, then selectActions > Edit. UnderGeneral Info, copy theIntegration Key GUID and save it in ds_config.py as your
- Run the launcher:
python run.py
Note: You will need to alias the python command to run Python 3 or usepython3 run.py - Open a browser tohttp://localhost:3000
docker image build -t docusign .docker run --name docusign_python -p 3000:3000 -d docusign
Note: If you downloaded this code usingQuickstart from the Docusign Developer Center, skip step 4 as it was automatically performed for you.
Also, in order to select JSON Web Token authentication in the launcher, in app/ds_config.py, change thequickstart setting to"false".
- Extract the Quickstart ZIP file or download or clone the code-examples-python repository.
- In your command-line environment, switch to the folder:
cd <Quickstart folder>orcd code-examples-python - To install dependencies, run:
pip3 install -r requirements.txt(or pipenv can be used) - To configure the launcher forJWT Grant authentication, create a copy of the file app/ds_config_sample.py and save the copy as app/ds_config.py.
- Add your User ID. On theApps and Keys page, underMy Account Information, copy theUser ID GUID and save it in ds_config.py as your
ds_impersonated_user_id. - Add your integration key. On theApps and Keys page, underApps and Integration Keys, choose the app to use, then selectActions > Edit. UnderGeneral Info, copy theIntegration Key GUID and save it in ds_config.py as your
ds_client_id. - Generate an RSA key pair, if you don’t already have one. UnderAuthentication, select+ GENERATE RSA. Copy the private key, and save it in a new file named app/private.key.
- Add the launcher’s redirect URI. UnderAdditional settings, select+ ADD URI, and set a redirect URI ofhttp://localhost:3000/ds/callback. SelectSAVE.
- Set a name and email address for the signer. In ds_config.py, save an email address as
signer_emailand a name assigner_name.
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.
- Add your User ID. On theApps and Keys page, underMy Account Information, copy theUser ID GUID and save it in ds_config.py as your
- Run the launcher:
python run.py
Note: You will need to alias the python command to run Python 3 or usepython3 run.py - Open a browser tohttp://localhost:3000
- On the black navigation bar, selectLogin.
- From the picklist, selectJSON Web Token >Authenticate with Docusign.
- When prompted, log in to your Docusign developer account. If this is your first time using the app, selectACCEPT at the consent window.
- Select your desired code example.
SeeDocusign 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.
Follow the instructions below if you downloaded the JWT grant remote signing example.
- Extract the Quickstart ZIP file or download or clone the code-examples-python repository.
- Run the JWT console project:
python jwt_console.py. If you do not already have the docusign-esign package, it will beinstalled for you when you start the project.Note: You will need to alias the python command to run Python 3 or usepython3 run.py - Follow the prompts from the command line to grant consent in your browser.
- Return to the command line and follow the prompts to enter the names and email addresses of your recipients.
- Check your email to sign the example document.
To use the payments code example, create a test payment gateway on thePayments page in your developer account. SeeConfigure a payment gateway for details.
Once you've created a payment gateway, save theGateway Account ID GUID to ds_config.py.
This repository uses the MIT License. SeeLICENSE for details.
Pull requests are welcomed. Pull requests will only be considered if their contentuses the MIT License.
About
Docusign Python code examples and launcher
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Python76.5%
- HTML21.4%
- JavaScript1.7%
- CSS0.3%
- Dockerfile0.1%
- Shell0.0%