Skip to main content

requestly macOS 本地转发工具 - 完整使用指南

📋 功能特性

✅ 将远程 API 请求自动转发到本地开发服务器
✅ 支持 HTTPS/HTTP 协议
✅ 纯 Python 实现,无需外部命令
✅ 一键自动安装/重装证书
✅ 灵活的配置文件支持
✅ 实时转发日志显示
✅ 专为 macOS 优化


🚀 快速开始

1. 安装依赖

pip install mitmproxy click

2. 创建配置文件

创建 config.json:

{
    "local_server": {
        "scheme": "http",
        "host": "127.0.0.1",
        "port": 8080
    },
    "rules": [
        {
            "description": "财务系统API",
            "remote": "https://sit-finance.xtt.xyz/settle/admin/settleBillRule/page"
        },
        {
            "description": "用户服务API - 自定义端口",
            "remote": "https://api.example.com/api/v1/users",
            "local": {
                "port": 3000
            }
        },
        {
            "description": "产品服务API - 完全自定义",
            "remote": "https://api.example.com/api/v1/products",
            "local": {
                "scheme": "https",
                "host": "localhost",
                "port": 3001
            }
        }
    ]
}

配置字段说明:

  • local_server (必填): 默认本地服务器配置

    • scheme: 协议 (http/https),默认 http
    • host: 地址,默认 127.0.0.1
    • port: 端口,默认 8080
  • rules (必填): 转发规则数组

    • description: 规则描述(可选,推荐填写,方便管理)
    • remote: 远程 URL(必填)
    • local: 本地目标配置(可选)
      • 如果不配置,使用 local_server 的配置
      • 可以只覆盖部分字段(如只改端口)
      • 支持 scheme、host、port 三个字段

配置优势:

✅ 语义清晰:local_server vs remote
✅ 层次分明:本地配置嵌套在 local 对象中
✅ 可读性强:rules 准确描述转发规则
✅ 支持注释:description 字段便于团队协作
✅ 灵活覆盖:可只覆盖需要的字段

3. 安装证书

# 自动安装(推荐)
python mitm_proxy.py install-cert --auto

# 仅查看安装说明
python mitm_proxy.py install-cert

4. 启动代理

# 基本启动
python mitm_proxy.py start config.json

# 自定义端口
python mitm_proxy.py start config.json --listen-port 9999

# 显示详细日志
python mitm_proxy.py start config.json -v

Metadata

Release files for requestly 0.0.2

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

Source distribution (sdist)

Source distribution for requestly 0.0.2
File Size Uploaded Provenance Actions
requestly-0.0.2.tar.gz 9.5 kB With provenance Details for requestly-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 17.2 kB

Release files / requestly-0.0.2.tar.gz

Download URL requestly-0.0.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0808644805a9e08add2efb7e975576ac29b61064cf4776f36a3514f907d56fc5
BLAKE2b-256 checksum
How to use checksums
1d7957bf4a281162405e60e59172d720d620434e8db6870e950e2d2106051fdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 16, 2026.

Transparency log

Release files / requestly-0.0.2-py3-none-any.whl

Download URL requestly-0.0.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c25e34ef9aa7eb5b46751d5fbdadbdbf4c4f9ac599bf1bb786b6b3097150b4f9
BLAKE2b-256 checksum
How to use checksums
a69c04d752b7ec7bcfd0cfeb2c48c2a516eecac2170149e3ed48a978afe74371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 16, 2026.

Transparency log

Security for requestly 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for requestly-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files Full provenance

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