[b]"How to properly use requests.post in Python for API calls?"[/b] or [b]"Getting errors with requests.post in Py

18 Replies, 793 Views

Hey! For JSON issues, validate your payload with https://jsonlint.com/. Might be a sneaky syntax error.

For retries, I just loop with a sleep:

```python
for _ in range(3):
try:
response = requests.post(url, json=data, headers=headers)
break
except:
time.sleep(1)
```

Not fancy, but works.

Messages In This Thread



Users browsing this thread: 1 Guest(s)