jdeip/README.md

40 lines
969 B
Markdown
Raw Normal View History

2025-10-17 17:05:19 +08:00
## JD EIP 代理轮换服务 (FastAPI)
基于京东 EIP API 的代理 IP 自动轮换后端。支持:
- 鉴权获取 `X-Token`
- 查询城市与设备
- 设置网关链路,自动切换到未使用过的 IP按天去重
- 使用 Redis 存储每日已使用 IP 与状态
### 运行
1. 创建并编辑 `.env`(参考 `.env.example`
2. 安装依赖:
```bash
pip install -r requirements.txt
```
3. 启动:
```bash
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```
### 目录结构
```
app/
config.py # 配置与环境变量
eip_client.py # 与 JD EIP API 交互
redis_store.py # Redis 存取封装
rotation_service.py # 轮换逻辑
routers/
proxy.py # /proxy API 路由
main.py # FastAPI 入口
```
### API 概览
- GET `/health` 健康检查
- POST `/proxy/rotate` 执行轮换(可传 cityhash/num
- GET `/proxy/status` 当前状态
### 备注
- EIP 详细接口见 `API.md`