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.2.0.tar.gz
(7.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file curl_parsers-0.2.0.tar.gz.
File metadata
- Download URL: curl_parsers-0.2.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4f2b09c3525130b63927fddd13ce07c3a54e45d668837f21655048fba3bb5ff
|
|
| MD5 |
267ac32dbe702f078c3b97e2eed5167b
|
|
| BLAKE2b-256 |
39b2a78bb9c7330fea415a9edaa4c059217e2322b642fac9b7655357887f1cd0
|
File details
Details for the file curl_parsers-0.2.0-py3-none-any.whl.
File metadata
- Download URL: curl_parsers-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.4 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 |
ce62ee68bb32a9e9eb5b75f8ed7387f4dcf8124d9b6ed39bc1aa5d59579b22aa
|
|
| MD5 |
3c337e20cdbff3783842cbe4f91a5932
|
|
| BLAKE2b-256 |
2ab48fea7d00a27e4afde5f8f36f3b02a1a49ea8bf5462769dd3b1add349b380
|