How to Properly Set and Modify Headers in Python Requests? or What Are the Best Practices for Handlin

20 Replies, 1728 Views

Wild guess: Are you sure the server even *accepts* JSON? Some APIs freak out if you send `'Accept': 'application/json'` but only serve XML.

Try `'Accept': '*/*'` as a fallback.

Also, `response.status_code` might give clues—403 or 401 means headers are def the issue.



Users browsing this thread: 1 Guest(s)