Live data from Hacker News

Convert Curl Syntax to Python Requests

curl.trillworks.com

31–40 of 47 posts

Re: Convert Curl Syntax to Python Requests

#32

Author, 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…

Thank you for making this. Wouldn't hacktoberfest tagging help some visibility for contribution?

Re: Convert Curl Syntax to Python Requests

#34
post #4

Failed 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

Even if the creator of a tool does read the thread, discussions like these are not the place to report bugs.

Re: Convert Curl Syntax to Python Requests

#38
I wrote a subroutine macos python to do the opposite.

On 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

#40

I'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

I've been looking for something like this for a while but I never wanted to spend the time actually searching when I could just spend the time converting it manually. Thanks for submitting this.
Post reply on HN