ConvertAPI / convertapi-library-python

A Python library for the ConvertAPI
https://www.convertapi.com
Other
77 stars 22 forks source link

convert parameters override #32

Open m4rio31 opened 1 year ago

m4rio31 commented 1 year ago

When I try to setup the StoreFile parameter in the conversion method

res = convertapi.convert('pdf', params={'File': <UploadIO object>, 'StoreFile': False})

the parameters normalization down below automatically overrides the StoreFile parameter fromFalse to True, actually blocking the in-memory conversion


def __normalize_params(self):
    params = {}

    for k, v in self.params.items():
        if k == 'File':
            params[k] = file_param.build(v)
        elif k == 'Files':
            results = utils.map_in_parallel(file_param.build, v, convertapi.max_parallel_uploads)

            for idx, val in enumerate(results):
                key = '%s[%i]' % (k, idx)
                params[key] = val
        else:
            params[k] = v

    params.update(self.default_params)  <----

    return params