This release is a pre-release and may not be stable for production use.
Uncurl-X - Converting curl requests to python httpx requests
In a nutshell
Uncurl-X is a library that allows you to convert curl requests into python code that uses httpx. Since the Chrome network inspector has a nifty "Copy as cURL", this tool is useful for recreating browser requests in python.
When you don't pass any arguments to uncurlx, it will use whatever is in your clipboard as the curl command.
This is a fork of uncurl by spulec which converts from curl to requests.
Example
$ uncurl "curl 'https://pypi.python.org/pypi/uncurlx' -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_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: foo=bar;' -H 'Connection: keep-alive' --compressed"
httpx.get("https://pypi.python.org/pypi/uncurlx", headers={
"Accept-Encoding": "gzip,deflate,sdch",
"Accept-Language": "en-US,en;q=0.8",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
}, cookies={
"foo": "bar",
})
The underlying API:
import uncurlx
print(uncurlx.parse("curl 'https://pypi.python.org/pypi/uncurlx' -H 'Accept-Encoding: gzip,deflate,sdch'"))
prints the string
'requests.get("https://pypi.python.org/pypi/uncurlx", headers={
"Accept-Encoding": "gzip,deflate,sdch",
})'
You can also retrieve the components as python objects:
>>> import uncurlx
>>> context = uncurl.parse_context("curl 'https://pypi.python.org/pypi/uncurlx' -H 'Accept-Encoding: gzip,deflate,sdch'")
>>> context.url
https://pypi.python.org/pypi/uncurlx
>>> context.headers
OrderedDict([('Accept-Encoding', 'gzip,deflate,sdch')])
On Mac OS, you can also pipe input to uncurlx:
pbpaste | uncurlx
Install
$ pip install uncurlx
Metadata
Release files for uncurlx 0.0.13rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uncurlx-0.0.13rc1.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uncurlx-0.0.13rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.5 kB
Release files / uncurlx-0.0.13rc1.tar.gz
| Download URL | uncurlx-0.0.13rc1.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1178f16f0d05baddd75e80121f8ed73bdd60017fc4b811646a1f2e189911b50f
|
|
BLAKE2b-256 checksum How to use checksums |
c23ea427001742131c657f77736eb69d4ddc435cd06adf74c55f6213dc159fb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2025.
Transparency logRelease files / uncurlx-0.0.13rc1-py3-none-any.whl
| Download URL | uncurlx-0.0.13rc1-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e803c67f5233bd5920efe39f20b66d41b66ef917312a29ff0cb12622f07a7e4a
|
|
BLAKE2b-256 checksum How to use checksums |
29c751957b477234d659caca904a41868e07d9198546902d00db53baf8a1a80d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2025.
Transparency log