docs: reorder README, remove comments

This commit is contained in:
test01
2026-01-03 04:12:07 +08:00
parent 3141f2a0ea
commit 9dec00220c

View File

@@ -2,6 +2,13 @@
Cloudflare Workers 代理 IP 池,使用 Cloudflare 全球边缘节点 IP 作为代理出口。
## 部署 Workers
1.`workers.js` 代码复制到 Cloudflare Workers
2. 绑定 KV 命名空间(名称为 `KV`
3. 设置环境变量 `ADMIN`(管理密码)
4. 配置自定义域名(可选)
## 安装
```bash
@@ -13,14 +20,15 @@ pip install cfspider
```python
import cfspider
# 发送请求,使用 Cloudflare IP 出口
cf_proxies = "https://your-workers.dev"
response = cfspider.get(
"https://httpbin.org/ip",
cf_proxies="https://your-workers.dev" # 替换为你的 Workers 地址
cf_proxies=cf_proxies
)
print(response.text) # {"origin": "172.64.xxx.xxx"}
print(response.cf_colo) # NRT (节点代码)
print(response.text)
print(response.cf_colo)
```
## 使用 Session
@@ -28,10 +36,10 @@ print(response.cf_colo) # NRT (节点代码)
```python
import cfspider
# 创建 Session只需设置一次
session = cfspider.Session(cf_proxies="https://your-workers.dev")
cf_proxies = "https://your-workers.dev"
session = cfspider.Session(cf_proxies=cf_proxies)
# 之后无需再指定 cf_proxies
r1 = session.get("https://httpbin.org/ip")
r2 = session.get("https://example.com")
@@ -39,10 +47,6 @@ print(r1.text)
session.close()
```
## 部署 Workers
`workers.js` 代码复制到 Cloudflare Workers 即可部署你自己的代理节点。
## License
MIT