Convert curl commands to Python requests code or JSON.
Project description
curl_parsers
介绍
curl命令转python代码,支持json格式数据转换
安装教程
- pip install curl_parsers
- 或者下载源码,解压后运行
使用说明
- 终端命令行输入:
方法一:
python -m curl_parsers.cli 'curl -X POST https://api.example.com/submit' --output python
python -m curl_parsers.cli 'curl -X POST https://api.example.com/submit' --output json
方法二:
uncurl 'curl -X POST https://api.example.com/submit' --output python
uncurl 'curl -X POST https://api.example.com/submit' --output json
- 调用函数:
from curl_parsers import parse_curl, to_python, to_json
curl_cmd = "curl -X POST https://api.example.com/submit"
print(parse_curl(curl_cmd)) # 解析curl命令并返回字典数据
print(to_python(curl_cmd)) # 转换为python代码
print(to_json(curl_cmd)) # 转换为json格式数据
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_parsers-0.1.3.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file curl_parsers-0.1.3.tar.gz
.
File metadata
- Download URL: curl_parsers-0.1.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bde71ab05f71d628bf83d93c60cb1cc8853cf1e03796a7dd86c41df096e25706 |
|
MD5 | 5f17d4aac2c7ee89df5409e852aff681 |
|
BLAKE2b-256 | 7208ef6999068b59f6ff1455e54430d9c26623505e68f6f994890aea67d6091c |
File details
Details for the file curl_parsers-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: curl_parsers-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c67641ab6a76a3a4c497fa6fc2cf2306a33c8e12a5e5370a664fbdff62e2d60d |
|
MD5 | b83fa9edb02575d926eb114a10010da0 |
|
BLAKE2b-256 | 6023f4b60fbb18acbe14477226aa2a5fc301a327ad98e21ad8bd9c93c8da8747 |