Skip to main content

服务器接口本地代理工具

Project description

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 的配置
      • 可以只覆盖部分字段(如只改端口)
      • 支持 schemehostport 三个字段

配置优势:

✅ 语义清晰: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

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

requestly-0.0.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requestly-0.0.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file requestly-0.0.2.tar.gz.

File metadata

  • Download URL: requestly-0.0.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for requestly-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0808644805a9e08add2efb7e975576ac29b61064cf4776f36a3514f907d56fc5
MD5 74fcd0b7c93070fd29dc7f6432f07b02
BLAKE2b-256 1d7957bf4a281162405e60e59172d720d620434e8db6870e950e2d2106051fdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for requestly-0.0.2.tar.gz:

Publisher: python-publish.yml on hyxf/requestly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file requestly-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: requestly-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for requestly-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c25e34ef9aa7eb5b46751d5fbdadbdbf4c4f9ac599bf1bb786b6b3097150b4f9
MD5 b9a20a6481d5a6a76c5536bf91564f7c
BLAKE2b-256 a69c04d752b7ec7bcfd0cfeb2c48c2a516eecac2170149e3ed48a978afe74371

See more details on using hashes here.

Provenance

The following attestation bundles were made for requestly-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on hyxf/requestly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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