[Answered ]-Django Rest Framework sending Request to External API – Expecting value: line 1 column 1 (char 0)

1👍

I’d say, it’s just a wrong URL in your call of the external API, as you are using some path without a domain.
So instead of

res = requests.post('external/api/url', headers=headers, data=payload, cert=(crt,key))

it should be sth. like

res = requests.post('https://SOMEDOMAIN.ORG/external/api/url', headers=headers, data=payload, cert=(crt,key))

0👍

Within the res = requests.post('external/api/url', headers=headers, data=payload, cert=(crt,key)), I had to change data=payload to data=json.dumps(payload). I’m assuming it didn’t like the way I formatted my payload initially. After that, I also deleted everything but the Content-Type: application/json out my headers dictionary.

Leave a comment