Converts cURL commands into equivalent Python Requests code
Project description
# curl_to_requests
curl_to_requests is a Python module that converts cURL commands into equivalent Python code using the requests library. Many cURL features are unsupported (it's a very complex piece of software), but curl_to_requests is far more complete than any of the other cURL converting utilities I've found.
Example:
```Python
from curl_to_requests import curl_to_requests
curl_cmd = '''curl 'https://github.com/mosesschwartz/curl_to_requests' \\
-H 'Accept-Encoding: gzip, deflate, sdch' \\
-H 'Accept-Language: en-US,en;q=0.8' \\
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36' \\
-H 'Accept: text/html, */*; q=0.01' \\
-H 'Referer: https://github.com/mosesschwartz/curl_to_requests' \\
-H 'Connection: keep-alive' --compressed'''
print curl_to_requests.curl_to_requests(curl_cmd)
```
curl_to_requests is a Python module that converts cURL commands into equivalent Python code using the requests library. Many cURL features are unsupported (it's a very complex piece of software), but curl_to_requests is far more complete than any of the other cURL converting utilities I've found.
Example:
```Python
from curl_to_requests import curl_to_requests
curl_cmd = '''curl 'https://github.com/mosesschwartz/curl_to_requests' \\
-H 'Accept-Encoding: gzip, deflate, sdch' \\
-H 'Accept-Language: en-US,en;q=0.8' \\
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36' \\
-H 'Accept: text/html, */*; q=0.01' \\
-H 'Referer: https://github.com/mosesschwartz/curl_to_requests' \\
-H 'Connection: keep-alive' --compressed'''
print curl_to_requests.curl_to_requests(curl_cmd)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
curl_to_requests-1.0.0.tar.gz
(10.0 kB
view hashes)
Built Distribution
Close
Hashes for curl_to_requests-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a659234698adc03fb721e8a7f0be237eec3d576fb46fcf7129ca33c251b310f2 |
|
MD5 | e7df71b02c4dec2820b8ae129fb8d4a8 |
|
BLAKE2b-256 | 082f84a5fcb24a9ed2842819a82bdcc9fe272ed9ec3f44a01b2cf4bd2f5036da |