Posting Image Data to API in Python and Django

Published: 14/01/2019
Posting Image Data to API in Python and Django
Source: STACKOVERFLOW.COM

I'm trying to upload an image to an API endpoint. It works using the API tester Restlet Client but I can't seem to get it to work in Python and Django. Can anyone see any obvious errors in my code? fh = open('1.jpg', 'rb'); base64img = base64.b64encode(fh.read()) photoAPIURL = "https://example.com" photoAPIRequestData = {"photo": base64img} photoAPIRequest = requests.post(photoAPIURL, da

Read more
Related news
Comment