Skip to content

Python SDK - Download files from SignatureRequestApi is not working anymore #471

@Striptik

Description

@Striptik

Hello,

I tried to download several signed documents from the api apis.SignatureRequestApi, with the method signature_request_files(signature_request_id, file_type="pdf") and it's not working anymore.

I implemented the same code as the exemple without success:

...
with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "fa5c8a0b0f492d768749333ad6fcc214c111e967"

    try:
        response = signature_request_api.signature_request_files_as_data_uri(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

The exception thrown is 'utf-8' codec can't decode byte 0xe2 in position 10: continuation byte

The end of the exception traceback and the locals variable values at the exception time can maybe help

/mnt/vendor/lib/python3.12/site-packages/dropbox_sign/api_client.py:313 in response_deserialize                                                         │

   305          elif response_type == "file":
   306             return_data = self.__deserialize_file(response_data)
   307          elif response_type is not None:
   308             match = None
   309             content_type = response_data.getheader("content-type")
   310             if content_type is not None:
   311                match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?"
   312             encoding = match.group(1) if match else "utf-8"
 ❱ 313             response_text = response_data.data.decode(encoding)
   314             return_data = self.deserialize(
   315                response_text, response_type, content_type
   316             )
   317       finally:
   318          if not 200 <= response_data.status <= 299:
   319             raise ApiException.from_response(
   320                http_resp=response_data,
   321                body=response_text,

 ── locals variables during the exception

content_type = 'application/pdf'
encoding = 'utf-8'
match = None 
msg = 'RESTResponse.read() must be called before passing it to response_deserialize()'                   
response_data = <dropbox_sign.rest.RESTResponse object at       
0xffff94684a30>                                 
response_text = None                                            
response_type = 'io.IOBase'                                     
response_types_map = {'200': 'io.IOBase', '4XX': 'ErrorResponse'}    
return_data = None                                            
-- 


UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 10: invalid continuation byte

It's working with the others download (Data Uri /File Url) methods, but i need the pdf directly so in the meantime I implemented the HTTP request and it's working, but less convenient

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDK - PythonAffects the Python SDKbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions