Skip to content

Commit 6a6eb05

Browse files
committed
merging master branch to resolve conflicts
2 parents 9be4613 + 05da190 commit 6a6eb05

10 files changed

Lines changed: 62 additions & 39 deletions

File tree

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
### Github repo: [code-examples-python](./)
44

5-
This GitHub repo includes code examples for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code example, modify the EXAMPLES_API_TYPE setting at the end of the ds_config.py file. Set 'Rooms' to True and 'ESignature' to False.
5+
This GitHub repo includes code examples for DocuSign APIs.
6+
7+
To switch between API code examples, modify the EXAMPLES_API_TYPE setting at the end of the configuration file. Set only one API type to true and set the remaining to false.
8+
9+
If none of the API types are set to true, the DocuSign eSignature REST API code examples will be shown. If multiple API types are set to true, only the first will be shown.
610

711
**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account).
812

@@ -169,7 +173,7 @@ This example demonstrates how to grant Office access to a Form Group.
169173
1. **Assign a form to a form group**
170174
[Source.](./app/rooms/examples/eg009_assign_form_to_form_group/controller.py)
171175
This example demonstrates how to assign a form to a form group.
172-
<!--
176+
173177
## Click API
174178

175179
1. **Create a clickwrap.**
@@ -186,7 +190,7 @@ This example demonstrates how to use DocuSign Click to get a list of clickwraps
186190
[Source.](./app/click/examples/eg006_list_clickwraps/controller.py)
187191
1. **Get clickwrap responses.**
188192
This example demonstrates how to use DocuSign Click to get user responses to your clickwrap agreements.
189-
[Source.](./app/click/examples/eg007_clickwrap_responses/controller.py) -->
193+
[Source.](./app/click/examples/eg007_clickwrap_responses/controller.py)
190194

191195
## Included OAuth grant types:
192196

@@ -225,8 +229,8 @@ When the token expires, it updates automatically.
225229
### Installation steps
226230
**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 4 and 5 below as they're automatically performed for you.**
227231

228-
1. Download or clone this repository to your workstation to directory **code-examples-python**
229-
1. **cd code-examples-python**
232+
1. Extract the Quickstart ZIP file or download or clone the **code-examples-python** repo.
233+
1. Switch to the folder: **cd <Quickstart_folder_name>** or **cd code-examples-python**
230234
1. **pip3 install -r requirements.txt** (or pipenv can be used)
231235

232236
**Note:** To run eSignature example 35, Request a signature by SMS, you will need to edit the SDK files. This is a temporary step that will be removed with future releases of the Python

app/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from .docusign.views import ds
99
from .ds_config import EXAMPLES_API_TYPE
1010
from .rooms import examples as rooms_examples
11-
# from .click import examples as click_examples
11+
from .click import examples as click_examples
1212
from .views import core
1313

1414
session_path = "/tmp/python_recipe_sessions"
1515

1616
if EXAMPLES_API_TYPE["Rooms"]:
1717
app = Flask(__name__, template_folder='rooms/templates')
18-
# elif EXAMPLES_API_TYPE["Click"]:
19-
# app = Flask(__name__, template_folder='click/templates')
18+
elif EXAMPLES_API_TYPE["Click"]:
19+
app = Flask(__name__, template_folder='click/templates')
2020
else:
2121
app = Flask(__name__)
2222
app.config.from_pyfile("config.py")
@@ -46,12 +46,13 @@
4646
app.register_blueprint(rooms_examples.eg007)
4747
app.register_blueprint(rooms_examples.eg008)
4848
app.register_blueprint(rooms_examples.eg009)
49-
# elif EXAMPLES_API_TYPE["Click"]:
50-
# app.register_blueprint(click_examples.eg001)
51-
# app.register_blueprint(click_examples.eg002)
52-
# app.register_blueprint(click_examples.eg003)
53-
# app.register_blueprint(click_examples.eg004)
54-
# app.register_blueprint(click_examples.eg005)
49+
50+
elif EXAMPLES_API_TYPE["Click"]:
51+
app.register_blueprint(click_examples.eg001)
52+
app.register_blueprint(click_examples.eg002)
53+
app.register_blueprint(click_examples.eg003)
54+
app.register_blueprint(click_examples.eg004)
55+
app.register_blueprint(click_examples.eg005)
5556
else:
5657
app.register_blueprint(examples.eg001)
5758
app.register_blueprint(examples.eg002)

app/click/examples/eg002_activate_clickwrap/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def worker(args):
3636
account_id=args["account_id"],
3737
clickwrap_id=args["clickwrap_id"],
3838
clickwrap_request=clickwrap_request,
39-
version_number="1"
39+
version_id="1"
4040
)
4141

4242
return response

app/docusign/ds_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"dtr.profile.write", "dtr.company.read", "dtr.company.write"
2222
]
2323

24-
# CLICK_SCOPES = [
25-
# "signature", "click.manage", "click.send"
26-
# ]
24+
CLICK_SCOPES = [
25+
"signature", "click.manage", "click.send"
26+
]
2727

2828

2929
class DSClient:
@@ -42,8 +42,8 @@ def _auth_code_grant(cls):
4242
oauth = OAuth(app)
4343
if EXAMPLES_API_TYPE["Rooms"]:
4444
use_scopes = ROOMS_SCOPES
45-
# elif EXAMPLES_API_TYPE["Click"]:
46-
# use_scopes = CLICK_SCOPES
45+
elif EXAMPLES_API_TYPE["Click"]:
46+
use_scopes = CLICK_SCOPES
4747
else:
4848
use_scopes = SCOPES
4949
request_token_params = {
@@ -72,8 +72,8 @@ def _jwt_auth(cls):
7272

7373
if EXAMPLES_API_TYPE["Rooms"]:
7474
use_scopes = ROOMS_SCOPES
75-
# elif EXAMPLES_API_TYPE["Click"]:
76-
# use_scopes = CLICK_SCOPES
75+
elif EXAMPLES_API_TYPE["Click"]:
76+
use_scopes = CLICK_SCOPES
7777
else:
7878
use_scopes = SCOPES
7979

app/docusign/views.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .utils import ds_logout_internal
77
from ..consts import base_uri_suffix
88
from ..ds_config import DS_CONFIG
9+
from ..ds_config import EXAMPLES_API_TYPE
910

1011
ds = Blueprint("ds", __name__, url_prefix="/ds")
1112

@@ -76,14 +77,16 @@ def ds_callback():
7677

7778
@ds.route("/must_authenticate")
7879
def ds_must_authenticate():
79-
if DS_CONFIG["quickstart"] == "true":
80+
if DS_CONFIG["quickstart"] == "true" and EXAMPLES_API_TYPE['ESignature']:
8081
return redirect(url_for("ds.ds_quickstart_auth"))
8182
else:
8283
return render_template("must_authenticate.html", title="Must authenticate")
8384

84-
@ds.route(("/quickstart_auth"))
85+
86+
@ds.route("/quickstart_auth")
8587
def ds_quickstart_auth():
86-
return render_template("quickstart_auth.html", title = "Must authenticate")
88+
return render_template("quickstart_auth.html", title="Must authenticate")
89+
8790

8891
@ds.route("/ds_return")
8992
def ds_return():

app/ds_config_sample.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@
4242
EXAMPLES_API_TYPE = {
4343
"Rooms": False,
4444
"ESignature": True,
45+
"Click": False
4546
}

app/eSignature/examples/eg035_sms_delivery/controller.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import base64
22
from os import path
33

4-
from docusign_esign import EnvelopesApi, EnvelopeDefinition, Document, Signer, CarbonCopy, SignHere, Tabs, Recipients, RecipientAdditionalNotification, RecipientPhoneNumber
4+
from docusign_esign import (
5+
EnvelopesApi,
6+
EnvelopeDefinition,
7+
Document,
8+
Signer,
9+
CarbonCopy,
10+
SignHere,
11+
Tabs,
12+
Recipients,
13+
RecipientPhoneNumber,
14+
RecipientAdditionalNotification,
15+
)
16+
517
from flask import session, request
618

719
from ....consts import demo_docs_path, pattern

app/templates/base.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ <h3>Working...&nbsp;&nbsp;&nbsp;<span></span></h3>
6868

6969
<p id="download-continue" class="feedback"><a href="/">Continue</a></p>
7070

71-
<div class="container-full-bg">
72-
<section id="content" style="padding-top:30px; padding-left:30px; padding-bottom:30px">
73-
{% block content %}{% endblock %}
71+
{% if 'ds_user_name' in session %}
72+
<div class="container">
73+
<section id="content" style="padding-top:30px;">
74+
{% else %}
75+
<div class="container-full-bg">
76+
<section id="content" style="margin-top:-60px!important; padding-top:30px!important;">
77+
{% endif %}
78+
{% block content %}{% endblock %}
7479
</section>
7580
</div>
7681

app/views.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,18 @@ def index():
1414
return render_template(
1515
"home_rooms.html", title="Home - Python Rooms API Code Examples"
1616
)
17-
# elif EXAMPLES_API_TYPE["Click"]:
18-
# return render_template(
19-
# "home_click.html", title="Home - Python Click API Code Examples"
20-
# )
17+
elif EXAMPLES_API_TYPE["Click"]:
18+
return render_template(
19+
"home_click.html", title="Home - Python Click API Code Examples"
20+
)
2121
if DS_CONFIG["quickstart"] == "true":
22-
return redirect(url_for("core.qshome"))
22+
DS_CONFIG["quickstart"] = 'false'
23+
return redirect(url_for("eg001.get_view"))
2324

2425
else:
2526
return render_template("home.html", title="Home - Python Code Examples")
2627

2728

28-
@core.route("/eg001")
29-
def qshome():
30-
return render_template("eg001_embedded_signing.html", title = "Homepage for Quickstart")
31-
32-
3329
@core.route("/index")
3430
def r_index():
3531
return redirect(url_for("core.index"))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Click
66
cryptography==3.2.1
77
docusign-esign==3.6.0
88
docusign-rooms==1.1.0rc1
9+
docusign-click==1.0.0
910
Flask==1.1.1
1011
Flask-OAuthlib
1112
flask-wtf==0.14.3

0 commit comments

Comments
 (0)