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.1.tar.gz
(8.5 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.1.tar.gz.
File metadata
- Download URL: curl_parsers-0.2.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2283ee5ce1bd1bf7d0c087ca3da41d5b4238cf72a7e98147d60ba58b9b194268
|
|
| MD5 |
700e15d775033ab4be2ea03b90e0abb1
|
|
| BLAKE2b-256 |
a86fb1d3d890b9f732da11e46081f509c45e3b8126b71d6f8da35b9a62d4e62a
|
File details
Details for the file curl_parsers-0.2.1-py3-none-any.whl.
File metadata
- Download URL: curl_parsers-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.3 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 |
5ed0a5bb4a1c0f4a2e4865c78534c717449376586adfdfd6b4d55c547cbba288
|
|
| MD5 |
1b9f90a008cb4328e076f49c90e329c7
|
|
| BLAKE2b-256 |
e8a83adb17f1e30a84ed773910700d20ab0330502a6ceb417b57a9d6ad7b7140
|