Skip to main content

BurpHTTPRequest

一个简单易用的Python HTTP请求处理库,支持从文件读取请求、设置代理、保存响应等功能。

特性

  • 从文件读取HTTP请求 包括 GET POST
  • 支持设置HTTP代理
  • 支持设置Cookie
  • 支持保存响应内容到文件
  • 支持移除压缩编码
  • 支持解析curl(bash)请求(chrome 浏览器右键-复制请求)

使用示例

更多实例见 test/main.py

pip install burphttp
from burphttp import burphttp

# 创建实例
bq = burphttp()

# 从文件读取请求
bq.parse_request_from_file("request.http")

# 从curl命令读取请求
bq.parse_request_from_curl("curlcommand.txt")

# 设置代理(可选)
bq.set_proxy("http://127.0.0.1:8080")

# 设置Cookie(可选)
bq.set_cookie("session=abc123; user=test; phpsessionid=123456")

# 移除压缩编码(可选)
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数据

image

如果你不确定自己的请求体是否可用,可以借助这个vscode插件: https://marketplace.visualstudio.com/items?itemName=humao.rest-client

更新日志

  • v0.1.4 2025-01-13 支持设置host
  • v0.1.6 2025-01-14 支持解析curl(bash)请求
  • v0.1.7 2025-01-15 修复了https时候的cookie消失问题

Metadata

Release files for burphttp 0.1.7

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

Source distribution (sdist)

Source distribution for burphttp 0.1.7
File Size Uploaded
burphttp-0.1.7.tar.gz 7.3 kB Details

Built distribution (wheel)

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

Total release size: 15.0 kB

Release files / burphttp-0.1.7.tar.gz

Download URL burphttp-0.1.7.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a647491727fdc6df2536d14c48489ff424bf72ce8453d1fdc8f850abb9afedc
BLAKE2b-256 checksum
How to use checksums
d164be49a3c60bdb57f8cf90beab9fa8319df7d588317cf17c42ffca34f45e6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.6

Release files / burphttp-0.1.7-py3-none-any.whl

Download URL burphttp-0.1.7-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61dade2d69ef94bcf35cc4b5d009b188ea65fcf2ab18c0dd2367498abbebbe3d
BLAKE2b-256 checksum
How to use checksums
4ee65705375cac9424ac67190e6c72817e58d7455a16196e1dc914af3b84382b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.7 This release

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

1 release file

0.1.1

1 release file

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