Skip to content

Commit 7eb3d7c

Browse files
committed
generate_upload_token: Refactor code to use 'optional_keys' list.
Process optional parameters like it is done in method "perform_upload", this will allow the introduction of more optional parameter.
1 parent d109ad5 commit 7eb3d7c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pydas/drivers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def create_link(self, token, folder_id, url, **kwargs):
922922
response = self.request('midas.link.create', parameters)
923923
return response
924924

925-
def generate_upload_token(self, token, item_id, filename, checksum=None):
925+
def generate_upload_token(self, token, item_id, filename, **kwargs):
926926
"""
927927
Generate a token to use for upload.
928928
@@ -953,8 +953,10 @@ def generate_upload_token(self, token, item_id, filename, checksum=None):
953953
parameters['token'] = token
954954
parameters['itemid'] = item_id
955955
parameters['filename'] = filename
956-
if checksum is not None:
957-
parameters['checksum'] = checksum
956+
optional_keys = ['checksum']
957+
for key in optional_keys:
958+
if key in kwargs:
959+
parameters[key] = kwargs[key]
958960
response = self.request('midas.upload.generatetoken', parameters)
959961
return response['token']
960962

0 commit comments

Comments
 (0)