Skip to main content

No project description provided

Project description

pwproxy


基于playwright实现mitmproxy的核心功能:请求拦截,响应篡改

优点

  1. 基于playwright,直接调用本地浏览器,不用以设置代理的方式启动浏览器, mitmproxy必须以冷启动设置代理的方法启动本地浏览器才能实现拦截
  2. 不需要考虑安全证书的问题

安装

pip install pwproxy

使用


目录结构:
├─run.py
├─demo.py
# run.py
from pwproxy.run import Run

Run.run("demo.py", url="http://example.com/")
# demo.py
from playwright.sync_api import Route


def replace_resp(route: Route):
    if "http://example.com/" in route.request.url:
        response = route.fetch()
        body = response.text()
        body = body.replace("Example Domain", "Goodo")
        route.fulfill(
            body=body
        )

addons = [
    replace_resp
]

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

pwproxy-0.0.9.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file pwproxy-0.0.9.tar.gz.

File metadata

  • Download URL: pwproxy-0.0.9.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for pwproxy-0.0.9.tar.gz
Algorithm Hash digest
SHA256 200ecadb70f26e66d5bd34b5fb47d57e94fa80cfa8e23fb26d35e497626e4ec6
MD5 2e06b542ed5420bfb118a0dd3c307979
BLAKE2b-256 1f802ff7f3b2873a8101d26f78018ec66c8db348a1ad132d89168fb90a33fb14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page