From e2a8109a672289c9b82499cceb6ac291376ab669 Mon Sep 17 00:00:00 2001 From: Matthew Attou Date: Wed, 22 Jul 2020 15:31:25 -0700 Subject: [PATCH 1/4] Rename request parameter per the api documentation --- hellosign_sdk/hsclient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hellosign_sdk/hsclient.py b/hellosign_sdk/hsclient.py index bdcdbcd..eec6e7f 100644 --- a/hellosign_sdk/hsclient.py +++ b/hellosign_sdk/hsclient.py @@ -958,7 +958,7 @@ def get_template_files(self, template_id, path_or_file=None, file_type=None, url += '?get_data_uri=1' return request.get(url) - def update_template_files(self, template_id, files=None, file_urls=None, + def update_template_files(self, template_id, files=None, file_url=None, subject=None, message=None, client_id=None, test_mode=False): ''' Overlays a new file with the overlay of an existing template. @@ -987,7 +987,7 @@ def update_template_files(self, template_id, files=None, file_urls=None, request = self._get_request() return request.post(self.TEMPLATE_UPDATE_FILES_URL + template_id, data={ "files": files, - "file_urls": file_urls, + "file_url": file_url, "subject": subject, "message": message, "test_mode": self._boolean(test_mode), From d9accb79cdf085b5d0fc3a49d94d21e5053cf270 Mon Sep 17 00:00:00 2001 From: Michael Gisi Date: Mon, 16 Nov 2020 16:47:19 -0500 Subject: [PATCH 2/4] fix unhandled exceptions --- hellosign_sdk/utils/request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hellosign_sdk/utils/request.py b/hellosign_sdk/utils/request.py index 95fc68e..853551f 100644 --- a/hellosign_sdk/utils/request.py +++ b/hellosign_sdk/utils/request.py @@ -258,7 +258,10 @@ def _check_error(self, response, json_response=None): raise err_cls("%s error: %s" % (response.status_code, json_response["error"]["error_msg"]), response.status_code) # This is to catch error when we post get oauth data except TypeError: - raise err_cls("%s error: %s" % (response.status_code, json_response["error_description"]), response.status_code) + try: + raise err_cls("%s error: %s" % (response.status_code, json_response["error_description"]), response.status_code) + except TypeError: + raise err_cls("%s error" % response.status_code) # Return True if everything is OK return True From f7c201d30f210d232b72a68f459d33482b23b450 Mon Sep 17 00:00:00 2001 From: Matthew Attou Date: Mon, 11 Jan 2021 22:14:12 -0800 Subject: [PATCH 3/4] Match API documentation naming https://app.hellosign.com/api/reference#create_embedded_template_draft --- hellosign_sdk/hsclient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hellosign_sdk/hsclient.py b/hellosign_sdk/hsclient.py index eec6e7f..1e81b46 100644 --- a/hellosign_sdk/hsclient.py +++ b/hellosign_sdk/hsclient.py @@ -958,7 +958,7 @@ def get_template_files(self, template_id, path_or_file=None, file_type=None, url += '?get_data_uri=1' return request.get(url) - def update_template_files(self, template_id, files=None, file_url=None, + def update_template_files(self, template_id, file=None, file_url=None, subject=None, message=None, client_id=None, test_mode=False): ''' Overlays a new file with the overlay of an existing template. @@ -986,7 +986,7 @@ def update_template_files(self, template_id, files=None, file_url=None, ''' request = self._get_request() return request.post(self.TEMPLATE_UPDATE_FILES_URL + template_id, data={ - "files": files, + "file": file, "file_url": file_url, "subject": subject, "message": message, From bbc0177298d38f6224f5fd4c6e827e9ab9c1c6e8 Mon Sep 17 00:00:00 2001 From: Matthew Attou Date: Tue, 12 Jan 2021 10:44:40 -0800 Subject: [PATCH 4/4] Added new file upload support for update template enpoint --- hellosign_sdk/hsclient.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hellosign_sdk/hsclient.py b/hellosign_sdk/hsclient.py index 1e81b46..85aefb0 100644 --- a/hellosign_sdk/hsclient.py +++ b/hellosign_sdk/hsclient.py @@ -984,6 +984,7 @@ def update_template_files(self, template_id, file=None, file_url=None, A Template object ''' + files_payload = HSFormat.format_file_params(file) request = self._get_request() return request.post(self.TEMPLATE_UPDATE_FILES_URL + template_id, data={ "file": file, @@ -992,7 +993,7 @@ def update_template_files(self, template_id, file=None, file_url=None, "message": message, "test_mode": self._boolean(test_mode), "client_id": client_id - }) + }, files=files_payload) def create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None,