How can I convert Python code to curl for API requests? or What's the best way to convert Python code

16 Replies, 1090 Views

If you’re lazy like me, just use `requests` debug mode to *almost* get curl commands.

Run your script with:
```bash
HTTPIE_DEBUG=1 python your_script.py
```

It won’t give *perfect* curl, but you’ll see the raw HTTP request. From there, tweaking it into curl is trivial.

Also, +1 for `curlify`—it’s the closest thing to magic for convert python code to curl.

Messages In This Thread



Users browsing this thread: 1 Guest(s)