diff --git a/hellosign_sdk/utils/hsformat.py b/hellosign_sdk/utils/hsformat.py index d110c1f..2508515 100644 --- a/hellosign_sdk/utils/hsformat.py +++ b/hellosign_sdk/utils/hsformat.py @@ -22,6 +22,7 @@ # SOFTWARE. # +import os class HSFormat(object): ''' Authentication object using HelloSign's access token ''' @@ -42,10 +43,13 @@ def format_file_params(files): ''' Utility method for formatting file parameters for transmission ''' - files_payload = {} + files_payload = [] if files: for idx, filename in enumerate(files): - files_payload["file[" + str(idx) + "]"] = open(filename, 'rb') + files_payload.append(( + 'file[%s]' % idx, + (os.path.basename(filename), open(filename, 'rb')) + )) return files_payload @staticmethod @@ -129,4 +133,4 @@ def format_custom_fields(list_of_custom_fields): @staticmethod def strip_none_values(dictionary): if dictionary: - return dict((key, value) for (key, value) in dictionary.items() if value) \ No newline at end of file + return dict((key, value) for (key, value) in dictionary.items() if value)