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 thanks to the top contributors, csells and jgroom33. Many others have pitched in over the last five years. Also, big thanks to Daniel Stenberg for writing curl in the first place.
The design is modular and separates the frontend (curl) from the backend (Python), so more input and output formats can be added. It tries to be smart about generating "clean" code, so it will, for example, remove the Content-Length header when it can be recomputed from the request content.
https://ryan.govost.es/http-translator/
It is also open source. Feedback or pull requests are welcome. https://github.com/rgov/http-translator
I wonder how many cookies/secret headers will be pasted by unaware and unknowing users.
In fact, can't HAR do this? I'd love to be able to just pass a HAR string to any HTTP client library, and have it execute that. Or call "dump_har()" (or "--dump-har") on any client, and have it spit out HAR that I can take it to any other client.
1. Open browser inspector, watch API requests for one I'm interested in
2. Right click, "Copy as cURL"
3. Paste into a text editor, remove some unnecessary headers, re-running the curl command to verify that the headers I removed aren't important
4. Convert into python requests so that I can play with the parameters
Also handy because even well documented API's don't have examples in every language, but most do have examples in curl. So you can easily take those example curl's and dump them out to something programatic in your language.
Plus, you probably have a text editor that knows about JSON, so it's easy to (say) remove keys from a JSON file, or even just keep the keys on separate lines and add/remove entire lines. I haven't seen a text editor (even Emacs!) that was as good at editing shell command parameters. It's a lot easier to quote special characters for JSON, too, compared to quoting special characters for my shell.
[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=658956
[2]: https://bugs.chromium.org/p/chromium/issues/detail?id=798498
It's very handy.
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)
An helper for building API request, for example, there is this great open source project: https://github.com/Kong/apiembed/
It supports a dozen of language.
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)Fyi, Go received about 1200 conversions last month. Thanks!
Curl -vLkXPOST https://www.google.com