Skip to main content

curl2req

把浏览器请求转换为 requests 请求的工具

用法

1 打开浏览器F12,右键 Copy -> Copy as cURL (bash) 2 把请求保存到文件,例如 .curl 3 运行命令

from curl2req import curl_to_req

curl_to_req('./.curl', "", ".res", output_file_prefix="samples-res-")

4 查看结果 vim .res/samples-res-xxx.json

5 查看 json 结构

from curl2req import get_json_paths
keys = get_json_paths(host, show=False)
for k in keys:
    k2 = k.replace('[]', '[0]')
    print(k, json_get_data(host, k2)[0])

上传

pip install build
rm -rf dist/* && python -m build
twine upload dist/*

pip install -e .

Metadata

Release files for curl2req 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for curl2req 0.1.8
File Size Uploaded
curl2req-0.1.8.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for curl2req 0.1.8
File Interpreter ABI Platform
curl2req-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / curl2req-0.1.8.tar.gz

Download URL curl2req-0.1.8.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f38b8231539af75a379ef6edc0d05c6f71b5e264240e808a6ebd2401b0fb4fe1
BLAKE2b-256 checksum
How to use checksums
86b469848603949ce0eb961eceb39b7c38128dcec3a8c77708e29672f70574a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

Release files / curl2req-0.1.8-py3-none-any.whl

Download URL curl2req-0.1.8-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a87fbe47b24fcd5b11e2b0a9eefc9616989dfa3a80b08bea3df89a60d1e000ae
BLAKE2b-256 checksum
How to use checksums
a3319728618547e6db6f2299dfb35b3d8d7368fba72895cf01e402565c1a508b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page