correct endpoint for Uloads API
from sp_api.base import Client, sp_endpoint
from sp_api.base.helpers import create_md5, fill_query_params
-
+import hashlib
class Upload(Client):
- @sp_endpoint('/uploads/v1/uploadDestinations/{}', method='POST')
+ @sp_endpoint('/uploads/2020-11-01/uploadDestinations/{}', method='POST')
def upload_document(self, resource, file, content_type='application/pdf', **kwargs):
md5 = create_md5(file)
+
kwargs.update({
'contentMD5': md5,
'contentType': kwargs.pop('contentType', content_type),
'marketplaceIds': self.marketplace_id
})
return self._request(fill_query_params(kwargs.pop('path'), resource), params=kwargs)
+
+ def upload_file(self, method, url, pdf, headers):
+ return self._upload(method, url, pdf, headers, params={"marketplaceIds": self.marketplace_id, "method": method})
+
