2 ms·
I want this in Python: https://codecodeship.com/blog/2024-06-03-curl_req https://codecodeship.com/blog/2024-06-03-curl_req From the article: """ ~CURL[cur
by behnamoh 2y ago
I want this in Python: https://codecodeship.com/blog/2024-06-03-curl_req https://codecodeship.com/blog/2024-06-03-curl_req
From the article:
"""
~CURL[curl https://catfact.ninja/fact]
|> Req.request!()
This is actual code; you can run this. It will convert the curl command into a Req request and you will get a response back. This is really great, because we have been able to increase the expressiveness of the language.
"""
- zelphirkalt 2y agoAnd somewhere there is the logic implemented to know what ~CURL is and what needs to happen with the part in square brackets, how it needs to be translated into a request call. And if that is merely an arguments equals arguments thingy, then it would be kind of useless, since there are usually more things one specifies when making a request from inside Python. Things like headers or whether or not to verify TLS certs, and that is not a 1 to 1 mapping between curl arguments and a requests call. So I remain doubtful, as long as no way is shown to me, how the user of the language can define this syntactic abstraction themselves, which is unlikely to happen or exist in Python.