Skip to content

Commit 1df2307

Browse files
garg-muditroot
and
root
authored
Version 5.0.0rc2-v2.1-24.2.00.00 release (#193)
Co-authored-by: root <root@devcenteradmin.docusigntest.com>
1 parent 010d8d5 commit 1df2307

File tree

6 files changed

+41
-54
lines changed

6 files changed

+41
-54
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
33

44
See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.
55

6+
## [v5.0.0rc2] - eSignature API v2.1-24.2.00.00 - 2024-08-22
7+
### Breaking Changes
8+
- Updated datatype for `get_document` method from `envelopes_api`.
9+
### Changed
10+
- Updated the SDK release version.
11+
612
## [v5.0.0rc1] - eSignature API v2.1-24.2.00.00 - 2024-06-28
713
### Changed
814
- Added support for version v2.1-24.2.00.00 of the DocuSign ESignature API.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This client SDK is provided as open source, which enables you to customize its f
3333
<a id="versionInformation"></a>
3434
### Version Information
3535
- **API version**: v2.1
36-
- **Latest SDK version**: 5.0.0rc1
36+
- **Latest SDK version**: 5.0.0rc2
3737

3838
<a id="requirements"></a>
3939
## Requirements

docusign_esign/client/api_client.py

+15-42
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import re
1818
import json
1919
import mimetypes
20-
import tempfile
2120
import threading
2221
import base64
2322
import math
@@ -188,7 +187,11 @@ def __call_api(self, resource_path, method,
188187
r.data = r.data.decode('utf8', 'replace')
189188
except (UnicodeDecodeError, AttributeError):
190189
pass
191-
return_data = self.deserialize(r, response_type)
190+
191+
if response_type == "file":
192+
return_data = r.data
193+
else:
194+
return_data = self.deserialize(r, response_type)
192195
else:
193196
return_data = None
194197

@@ -255,10 +258,9 @@ def deserialize(self, response, response_type):
255258
256259
:return: deserialized object.
257260
"""
258-
# handle file downloading
259-
# save response body into a tmp file and return the instance
261+
# handle file type response
260262
if response_type == "file":
261-
return self.__deserialize_file(response)
263+
return response.data
262264

263265
# fetch data from response object
264266
try:
@@ -551,35 +553,6 @@ def update_params_for_auth(self, headers, querys, auth_settings):
551553
'Authentication token must be in `query` or `header`'
552554
)
553555

554-
def __deserialize_file(self, response):
555-
"""
556-
Saves response body into a file in a temporary folder,
557-
using the filename from the `Content-Disposition` header if provided.
558-
559-
:param response: RESTResponse.
560-
:return: file path.
561-
"""
562-
config = Configuration()
563-
564-
fd, path = tempfile.mkstemp(dir=config.temp_folder_path)
565-
os.close(fd)
566-
os.remove(path)
567-
568-
content_disposition = response.getheader("Content-Disposition")
569-
if content_disposition:
570-
filename = re.\
571-
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\
572-
group(1)
573-
curr_time = datetime.now()
574-
formatted_time = curr_time.strftime('%m%d%Y_%H%M%S_%f')
575-
filename = "{}_{}".format(formatted_time, filename)
576-
path = os.path.join(os.path.dirname(path), filename)
577-
578-
with open(path, "wb") as f:
579-
f.write(response.data)
580-
581-
return path
582-
583556
def __deserialize_primitive(self, data, klass):
584557
"""
585558
Deserializes string to primitive type.
@@ -671,9 +644,9 @@ def request_jwt_user_token(self, client_id, user_id, oauth_host_name, private_ke
671644
scopes=(OAuth.SCOPE_SIGNATURE,)):
672645
"""
673646
Request JWT User Token
674-
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
675-
:param user_id: DocuSign user Id to be impersonated
676-
:param oauth_host_name: DocuSign OAuth host name
647+
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
648+
:param user_id: Docusign user Id to be impersonated
649+
:param oauth_host_name: Docusign OAuth host name
677650
:param private_key_bytes: the byte contents of the RSA private key
678651
:param expires_in: number of seconds remaining before the JWT assertion is considered as invalid
679652
:param scopes: Optional. The list of requested scopes may include (but not limited to) You can also pass any
@@ -714,8 +687,8 @@ def request_jwt_application_token(self, client_id, oauth_host_name, private_key_
714687
scopes=(OAuth.SCOPE_SIGNATURE,)):
715688
"""
716689
Request JWT Application Token
717-
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
718-
:param oauth_host_name: DocuSign OAuth host name
690+
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
691+
:param oauth_host_name: Docusign OAuth host name
719692
:param private_key_bytes: the byte contents of the RSA private key
720693
:param expires_in: number of seconds remaining before the JWT assertion is considered as invalid
721694
:param scopes: Optional. The list of requested scopes may include (but not limited to) You can also pass any
@@ -772,8 +745,8 @@ def get_user_info(self, access_token):
772745
def generate_access_token(self, client_id, client_secret, code):
773746
"""
774747
GenerateAccessToken will exchange the authorization code for an access token and refresh tokens.
775-
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
776-
:param client_secret: The secret key you generated when you set up the integration in DocuSign Admin console.
748+
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
749+
:param client_secret: The secret key you generated when you set up the integration in Docusign Admin console.
777750
:param code: The authorization code
778751
:return: OAuthToken object
779752
"""
@@ -828,7 +801,7 @@ def set_access_token(self, token_obj):
828801
def get_authorization_uri(self, client_id, scopes, redirect_uri, response_type, state=None):
829802
"""
830803
Helper method to configure the OAuth accessCode/implicit flow parameters
831-
:param client_id: DocuSign OAuth Client Id(AKA Integrator Key)
804+
:param client_id: Docusign OAuth Client Id(AKA Integrator Key)
832805
:param scopes: The list of requested scopes. Client applications may be scoped to a limited set of system access.
833806
:param redirect_uri: This determines where to deliver the response containing the authorization code
834807
:param response_type: Determines the response type of the authorization request, NOTE: these response types are

docusign_esign/client/configuration.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ def __init__(self):
5555
# Default api client
5656
self.api_client = None
5757

58-
# Temp file folder for downloading files
59-
self.temp_folder_path = None
60-
6158
# Authentication Settings
6259
# dict to store API key(s)
6360
self.api_key = {}
@@ -119,9 +116,9 @@ def __init__(self):
119116
python_version = platform.python_version()
120117

121118
if six.PY3:
122-
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc1/python3/" + f"{python_version}"
119+
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc2/python3/" + f"{python_version}"
123120
else:
124-
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc1/python2/" + f"{python_version}"
121+
self.user_agent = "Swagger-Codegen/v2.1/5.0.0rc2/python2/" + f"{python_version}"
125122

126123

127124
@classmethod
@@ -277,5 +274,5 @@ def to_debug_report(self):
277274
"OS: {env}\n"\
278275
"Python Version: {pyversion}\n"\
279276
"Version of the API: v2.1\n"\
280-
"SDK Package Version: 5.0.0rc1".\
277+
"SDK Package Version: 5.0.0rc2".\
281278
format(env=sys.platform, pyversion=sys.version)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from setuptools import setup, find_packages, Command, os # noqa: H301
1515

1616
NAME = "docusign-esign"
17-
VERSION = "5.0.0rc1"
17+
VERSION = "5.0.0rc2"
1818
# To install the library, run the following
1919
#
2020
# python setup.py install

test/unit_tests.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import subprocess
88
import unittest
9+
import tempfile
910

1011
from time import sleep
1112
from datetime import datetime
@@ -492,8 +493,10 @@ def testDownLoadEnvelopeDocuments(self):
492493

493494
file1 = envelopes_api.get_document(self.user_info.accounts[0].account_id, 'combined', self.envelope_id)
494495

495-
assert len(file1) > 0
496-
subprocess.call('open ' + file1, shell=True)
496+
temporary_file = tempfile.NamedTemporaryFile(delete=False)
497+
with open(temporary_file.name + ".pdf", "wb") as f:
498+
f.write(file1)
499+
subprocess.call('open ' + temporary_file.name + ".pdf", shell=True)
497500

498501
except ApiException as e:
499502
print("\nException when calling DocuSign API: %s" % e)
@@ -682,14 +685,22 @@ def testGetDiagnosticLogs(self):
682685
envelope_id = envelope_summary.envelope_id
683686

684687
file1 = envelopes_api.get_document(self.user_info.accounts[0].account_id, 'combined', envelope_id)
688+
temporary_file1 = tempfile.NamedTemporaryFile(delete=False)
689+
with open(temporary_file1.name + ".pdf", "wb") as f:
690+
f.write(file1)
691+
685692
assert len(file1) > 0
686-
subprocess.call('open ' + file1, shell=True)
693+
subprocess.call('open ' + temporary_file1.name + ".pdf", shell=True)
687694

688695
logs_list = diag_api.list_request_logs()
689696
request_log_id = logs_list.api_request_logs[0].request_log_id
690697
file2 = diag_api.get_request_log(request_log_id)
698+
temporary_file2 = tempfile.NamedTemporaryFile(delete=False)
699+
with open(temporary_file2.name + ".txt", "wb") as f:
700+
f.write(file2)
701+
691702
assert len(file2) > 0
692-
subprocess.call('open ' + file2, shell=True)
703+
subprocess.call('open ' + temporary_file2.name + ".txt", shell=True)
693704

694705
except ApiException as e:
695706
print("\nException when calling DocuSign API: %s" % e)

0 commit comments

Comments
 (0)