This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
Incorrect use of requests leads to random order for multiple files #34
Labels
legacy
Related to legacy, non-OpenAPI SDK
When a signature request is created with multiple files, the SDK sends them in a manner that results in them appearing in random order when they have to be signed. I've been digging into this and have found the cause which I'll explain below.
When a signature request is created that includes files, the
HSClient
class uses theHSFormat
class to convert them into a data structure used in the request: https://github.com/HelloFax/hellosign-python-sdk/blob/ac8a1fcea8f4c2fdc56a408bc4d50efa7c6bfd91/hellosign_sdk/hsclient.py#L1383 like so: https://github.com/HelloFax/hellosign-python-sdk/blob/ac8a1fcea8f4c2fdc56a408bc4d50efa7c6bfd91/hellosign_sdk/hsclient.py#L1427However the
HSFormat
creates an inappropriate data structure for this:https://github.com/HelloFax/hellosign-python-sdk/blob/ac8a1fcea8f4c2fdc56a408bc4d50efa7c6bfd91/hellosign_sdk/utils/hsformat.py#L40-L49Basically, it creates a dictionary with a
"file[j]"
key for each file. This dictionary is eventually fed into a call to thepost
method of the Requests library as thefiles
argument: https://github.com/HelloFax/hellosign-python-sdk/blob/ac8a1fcea8f4c2fdc56a408bc4d50efa7c6bfd91/hellosign_sdk/utils/request.py#L167However, the documentation for the Requests library states that a list (which is an ordered iterable) be used for this argument here and the example clearly is of a
list
oftuple
s:What I'm guessing happens is that the Requests library converts the dictionary into a list, ignoring the keys and appending only the values in a random order because
dict
is an unordered data structure.The text was updated successfully, but these errors were encountered: