Had this exact headache yesterday! Two things:
1. Some APIs need the `Accept` header too:
```python
headers = {'Accept': 'application/json'}
```
2. Your `json=` might be fine, but if the server’s weird, try `json.dumps()` + `data=`:
```python
import json
response = requests.post(url, data=json.dumps({'key': 'value'}), headers=headers)
```
For retries, `urllib3` has a built-in retry thingy.
---
Oh wow, thanks y’all! Didn’t realize headers were such a big deal—adding `Content-Type` fixed it for one API.
But now I’m getting a 403 on another endpoint. Could it be a auth thing even if the docs don’t mention it?
Also, `tenacity` looks dope for retries—gonna try that next.
Side note: logging.debug was a game-changer. Why didn’t I know about that sooner?!
Thanks again 🙌
1. Some APIs need the `Accept` header too:
```python
headers = {'Accept': 'application/json'}
```
2. Your `json=` might be fine, but if the server’s weird, try `json.dumps()` + `data=`:
```python
import json
response = requests.post(url, data=json.dumps({'key': 'value'}), headers=headers)
```
For retries, `urllib3` has a built-in retry thingy.
---
Oh wow, thanks y’all! Didn’t realize headers were such a big deal—adding `Content-Type` fixed it for one API.
But now I’m getting a 403 on another endpoint. Could it be a auth thing even if the docs don’t mention it?
Also, `tenacity` looks dope for retries—gonna try that next.
Side note: logging.debug was a game-changer. Why didn’t I know about that sooner?!
Thanks again 🙌
