Failed for this one Curl -vLkXPOST https://www.google.com
Because that's not a "curl" command. It's a "Curl" command.
Convert Curl Syntax to Python Requests
31–40 of 47 posts
Re: Convert Curl Syntax to Python Requests
#32Author, here. curlconverter gets about 17k unique users per month. The code generated by this tool is probably in production all over the world. But the codebase needs maintenance! I hired a junior developer (cf512) to do about 40 hours of dev work last month, but that contract has ended and I'd appreciate more volunteers. All the code is open source. I see a few bug reports down thread. Please open tickets. A big th…
Re: Convert Curl Syntax to Python Requests
#33oh hey, I wrote the `Go` support for this tool.
Fyi, Go received about 1200 conversions last month. Thanks!
Re: Convert Curl Syntax to Python Requests
#34Failed entirely to work on my first attempt with: curl -XHEAD https://google.com It is just flat out wrong on: curl -X HEAD https://google.com In that it does a GET request: import requests response = requests.get('https://google.com/') Clever idea, but my first totally valid example failed (it does OPTIONS, GET, POST, PUT, PATCH successfully)
In case the creator of this tool doesn't read this thread, you can report the issues on GitHub: https://github.com/NickCarneiro/curlconverter/issues
Re: Convert Curl Syntax to Python Requests
#35Re: Convert Curl Syntax to Python Requests
#36Re: Convert Curl Syntax to Python Requests
#37Re: Convert Curl Syntax to Python Requests
#38On macos, requests is not included (although it can be installed with a little effort), but curl was there.
Note that you can easily automate interacting with a web page using the developer menus in safari and firefox.
monitor the network requests, then for the request you're interested in, use "copy as cURL'. You can copy/paste that to invoke curl in the same way the web page used it.
(sometime I have to use --cookie-jar /tmp/cook --cookie /tmp/cook)
Re: Convert Curl Syntax to Python Requests
#39Re: Convert Curl Syntax to Python Requests
#40I'm not the author of this tool, but I submitted it to HN because I just stumbled upon it after unsuccessfully trying to transpose a complicated cURL from Chrome devtools into python requests for a good 20 min. This worked instantly. Props to the author - https://twitter.com/nickc_dev