session = requests.Session()
url = "...api/auth/login"
payload = {
"userName": "[email protected]",
"password": "password"
}
headers = {'content-type': 'application/json'}
response = session.post(url, data=json.dumps(payload), headers=headers)
png_uri = DataURI.from_file(image_path)
files = {
'file': (
os.path.basename(image_path),
png_uri,
'image/png'
),
'filename': os.path.basename(image_path),
'upload': '',
}
response = session.post(upload_url, files=files)
print(response.text)
As shown in the code above I open the image and convert it to dataURI that I send to the endpoint via a POST request.
The issue is that I'm getting an error:
{"error code":400,"message":"Invalid file type"}
Any idea what am I missing here?

