一个用于解析和发送HTTP请求的Python库,支持代理和保存响应
Project description
BurpHTTPRequest
一个简单易用的Python HTTP请求处理库,支持从文件读取请求、设置代理、保存响应等功能。
特性
- 从文件读取HTTP请求 包括 GET POST
- 支持设置HTTP代理
- 支持设置Cookie
- 支持保存响应内容到文件
- 支持移除压缩编码
使用示例
更多实例见 test/main.py
pip install burphttp
from burphttp import burphttp
# 创建实例
bq = burphttp()
# 从文件读取请求
bq.parse_request_from_file("request.http")
# 设置代理(可选)
bq.set_proxy("http://127.0.0.1:8080")
# 设置Cookie(可选)
bq.set_cookie("session=abc123; user=test")
# 移除压缩编码(可选)
bq.fixEncoding()
# 发送请求
bq.send_request()
# 保存响应体到文件
bq.save_response_body("response.txt")
# 打印响应信息
print(bq.response_status_code) # 状态码
print(bq.response_headers) # 响应头
print(bq.response_body) # 响应体
HTTP请求文件格式
请求文件格式示例:
POST /api/test HTTP/1.1
Host: example.com
Content-Type: application/json
{"key": "value"}
可以用火狐浏览器获取原始请求 GET:
- 右键-复制请求头(Q) POST:
- 右键-复制请求头(Q)
- 手动起一个空行
- 右键-复制Post数据
如果你不确定自己的请求体是否可用,可以借助这个vscode插件: https://marketplace.visualstudio.com/items?itemName=humao.rest-client
更新日志
- v0.1.4 2025-01-13 支持设置host
- v0.1.5 2025-01-14 支持解析curl(bash)请求
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
burphttp-0.1.5.tar.gz
(6.0 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 burphttp-0.1.5.tar.gz.
File metadata
- Download URL: burphttp-0.1.5.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4080d7846d92bc3ab58ad92f2b81fcfd59b4e597406594a5eb9a88045379a690
|
|
| MD5 |
e8423b563b662a01e6c63e3953ed8ff9
|
|
| BLAKE2b-256 |
f65a492fdc6ded84ae2e9147ab47c2e7c6939d3069ca09014d50e66d41e1cfea
|
File details
Details for the file burphttp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: burphttp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7c78770b9f87ec711a5c4489e8cfc8aca06312d9bcdb75b83bee68bffce009b
|
|
| MD5 |
b8c9fdfe4e50b3839e066303ae5000ab
|
|
| BLAKE2b-256 |
8052e8f3b36bd17c05e1f073b6a1cc20cd9c105c61bc638d77f92a243c97acd7
|