curlformat
A Python package to convert curl commands to Python HTTP client code.
Features
- Convert curl commands to Python code for various HTTP libraries:
- requests (default)
- httpx (with sync and async support)
- aiohttp
- pycurl
- pyhttpx
- curl_cffi (with sync and async support, random browser impersonation)
- requests_go (with TLS configuration support)
- Parse curl commands from command line, clipboard, or stdin
- Support for headers, cookies, data, and more
Installation
pip install curlformat
Usage
Command Line
# Basic usage (converts to requests)
curlformat 'curl -X GET "https://api.example.com"'
# Convert to httpx
curlformat --httpx 'curl -X GET "https://api.example.com"'
# Convert to async httpx
curlformat --httpx --async 'curl -X GET "https://api.example.com"'
# Convert to aiohttp
curlformat --aiohttp 'curl -X GET "https://api.example.com"'
# Convert to curl_cffi with random browser impersonation
curlformat --curl-cffi 'curl -X GET "https://api.example.com"'
# Convert to requests_go with TLS configuration
curlformat --requests-go 'curl -X GET "https://api.example.com"'
# Read from clipboard if no curl command is provided
curlformat --httpx
# Read from stdin
cat curl_command.txt | curlformat --pycurl
Python API
from curlformat import parse
# Convert curl command to requests code
python_code = parse('curl -X GET "https://api.example.com"')
print(python_code)
# If httpx is installed
from curlformat import parse_httpx, parse_httpx_async
# Convert to httpx code
httpx_code = parse_httpx('curl -X GET "https://api.example.com"')
print(httpx_code)
# Convert to async httpx code
httpx_async_code = parse_httpx_async('curl -X GET "https://api.example.com"')
print(httpx_async_code)
# If curl_cffi is installed
from curlformat import parse_curl_cffi, parse_curl_cffi_async
# Convert to curl_cffi code with random browser impersonation
curl_cffi_code = parse_curl_cffi('curl -X GET "https://api.example.com"')
print(curl_cffi_code)
# Convert to async curl_cffi code with random browser impersonation
curl_cffi_async_code = parse_curl_cffi_async('curl -X GET "https://api.example.com"')
print(curl_cffi_async_code)
# If requests_go is installed
from curlformat import parse_requests_go
# Convert to requests_go code with TLS configuration
requests_go_code = parse_requests_go('curl -X GET "https://api.example.com"')
print(requests_go_code)
Optional Dependencies
The package has the following optional dependencies:
httpx: For httpx supportaiohttp: For aiohttp supportpycurl: For pycurl supportpyhttpx: For pyhttpx supportcurl_cffi: For curl_cffi support with random browser impersonationrequests_go: For requests_go support with TLS configuration
You can install all optional dependencies with:
pip install curlformat[all]
Or install specific dependencies:
pip install curlformat[httpx,aiohttp]
License
MIT
Metadata
Release files for curlformat 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| curlformat-0.1.4.tar.gz | 18.6 kB | Without provenance | Details for curlformat-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| curlformat-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for curlformat-0.1.4-py3-none-any.whl |
Total release size: 44.7 kB
Release files / curlformat-0.1.4.tar.gz
| Download URL | curlformat-0.1.4.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a95a6cc03c66f4cf8a06f7211608f45fbe63e13ea272fb91b7bb1be294eedd57
|
|
BLAKE2b-256 checksum How to use checksums |
bbee4b8a8f29c881990e90623be1e37a81a84ca341ece1a2fc8a233c8173fcd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Release files / curlformat-0.1.4-py3-none-any.whl
| Download URL | curlformat-0.1.4-py3-none-any.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24f8a543b93bf5f6f0497b979f30eb35449a6b9e0563cec16b9ac970f63b3bd9
|
|
BLAKE2b-256 checksum How to use checksums |
f6fe38f1ea0bb1ba55f3543ab478bceb06957cf3a16c84887d300a2a7759eff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.5
|
Security for curlformat 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.