Seems like there are not many code sample there, and the requests documentation was giving the wrong hint to use files={'file': open('image.jpg')} which you will end up getting 415 response code.
I think I will just share my working sample code here to save someone’s time
import requests
# local file
with open('image.jpg', 'rb') as file:
resp = requests.post('http://localhost:8888/image', data=file.read())
url = resp.headers['Location']
# remote file
remote_resp = requests.get(image_url, stream=True)
resp = requests.post('http://localhost:8888/image', data=remote_resp.content)
url = resp.headers['Location']