"Having trouble with requests post in Python—any tips?"
Hey folks!
I’ve been messing around with requests post python for API calls, but it’s not working like I expected.
Sometimes the data doesn’t send, or I get weird errors. Am I missing something obvious?
Here’s what I’m trying:
```python
import requests
response = requests.post(url, json={'key': 'value'})
```
But the server acts like it’s getting nada.
Are headers mandatory? Should I use `data=` instead of `json=`?
Also, how do you guys handle timeouts and retries? Feels like my code’s kinda fragile rn.
Any examples or pro tips would be clutch!
Thanks in advance 🙏
Hey folks!
I’ve been messing around with requests post python for API calls, but it’s not working like I expected.
Sometimes the data doesn’t send, or I get weird errors. Am I missing something obvious?
Here’s what I’m trying:
```python
import requests
response = requests.post(url, json={'key': 'value'})
```
But the server acts like it’s getting nada.
Are headers mandatory? Should I use `data=` instead of `json=`?
Also, how do you guys handle timeouts and retries? Feels like my code’s kinda fragile rn.
Any examples or pro tips would be clutch!
Thanks in advance 🙏
