Need help with a request post Python script – any tips or examples? or How to properly format a reque

12 Replies, 1111 Views

Yo, your code looks mostly fine, but here’s a pro tip: wrap your `my_data` in `json.dumps()` just to be safe. Sometimes the `json` param in requests doesn’t serialize things perfectly.

```python
import json
response = requests.post(url, data=json.dumps(my_data), headers=headers)
```

Also, check if the API docs mention any specific header requirements. APIs can be picky!

Messages In This Thread



Users browsing this thread: 1 Guest(s)