Skip to main content

No project description provided

Project description

pwproxy


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

优点

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

安装

pip install pwproxy-X.X.X-py3-none-any.whl

使用


目录结构:
├─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.8.tar.gz (8.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: pwproxy-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 46489afb63fed9b49ffd11944702802e2b2d38e08d0426ff21d86fd840de7879
MD5 575bdc5c09b630e5ef82551bbc757f4d
BLAKE2b-256 c10ce40c9a56d53b49fe1b3f700d17175d07db475aec15e3bff567ebab0df0fb

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