curl2pyreqs
A library to convert curl to python requests file.
Requirement
Python >= 3.6
pyperclip >= 1.8.0
rich >= 9.13.0
On Linux, xclip or xsel needed:
sudo apt-get install xclip
or
sudo apt-get install xsel
Install
$ pip install curl2pyreqs
Usage
Use as binary
- Export curl request file to python script.
$ curl2pyreqs -F example.curl
Convertion Finished.
Please open example.py to check the code.
- Convert curl request in the clipboard and paste the requests code back
$ curl2pyreqs
Convertion Finished.
Now requests code is copyed in your clipboard.
Use by importing
- Convert a curl string to python-requests, copyed from Chrome or Firefox:
>>> from curl2pyreqs.ulti import parseCurlString
>>> output = parseCurlString("""curl -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'accept-language: en-US,en;q=0.5' --compressed -H 'upgrade-insecure-requests: 1' -H 'te: trailers' https://pypi.org/""")
>>> print(output)
- Convert curl file stream to python-requests, copyed from Chrome or Firefox:
>>> from curl2pyreqs.ulti import parseCurlFile
>>> output = parseCurlFile('./example.curl')
>>> print(output)
README_CN
Metadata
Release files for curl2pyreqs 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| curl2pyreqs-0.4.1.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| curl2pyreqs-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.3 kB
Release files / curl2pyreqs-0.4.1.tar.gz
| Download URL | curl2pyreqs-0.4.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f45d874948fdac9d35ce9e6db9959b678236f5d7d76fd3c7a474d973b1c1b2a
|
|
BLAKE2b-256 checksum How to use checksums |
6730f7523afac2470ccbaddb7c32ea1aa09c7321b0176cc0a71dc79fdc3746b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.10
|
Release files / curl2pyreqs-0.4.1-py3-none-any.whl
| Download URL | curl2pyreqs-0.4.1-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd1d32600046c388e97b6d7739a9b282d0a24e7a2a89988fa7d24ff5d07ea1bc
|
|
BLAKE2b-256 checksum How to use checksums |
7bb48f01ef41771f2e583061453a4cf1eb018acab5d52737e3e1b4976cbaa3fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.10
|