"Getting errors with requests.post in Python - any solutions?"
Hey guys,
I’m trying to use requests.post python to hit an API, but keep getting errors. Like, sometimes it’s a 400 or 500, other times the JSON just won’t send right.
Here’s my code:
```python
response = requests.post(url, json=data, headers=headers)
```
Am I missing something? The API docs say it should work, but nah.
Also, how do you handle timeouts or retries? Mine just fails silently sometimes.
Any tips or fixes? Thanks!
---
*PS: If you’ve got a better way to structure the request, lmk!*
Hey guys,
I’m trying to use requests.post python to hit an API, but keep getting errors. Like, sometimes it’s a 400 or 500, other times the JSON just won’t send right.
Here’s my code:
```python
response = requests.post(url, json=data, headers=headers)
```
Am I missing something? The API docs say it should work, but nah.
Also, how do you handle timeouts or retries? Mine just fails silently sometimes.
Any tips or fixes? Thanks!
---
*PS: If you’ve got a better way to structure the request, lmk!*
