mirror of
https://github.com/violettoolssite/CFspider.git
synced 2026-04-05 19:39:01 +08:00
docs: add UUID requirement notes to functions that don't need it
This commit is contained in:
@@ -9,6 +9,18 @@ CFspider - Cloudflare 代理 IP 池 Python 库
|
||||
- IP 地图可视化(生成 Cyberpunk 风格的地图)
|
||||
- 网页镜像(保存网页到本地,自动重写资源链接)
|
||||
|
||||
UUID 使用说明:
|
||||
需要 UUID 的方法(使用 VLESS 协议):
|
||||
- cfspider.get/post/... (使用 cf_proxies 时)
|
||||
- cfspider.Session
|
||||
- cfspider.StealthSession
|
||||
|
||||
无需 UUID 的方法(使用 /proxy API):
|
||||
- cfspider.AsyncSession
|
||||
- cfspider.aget/apost/...
|
||||
- cfspider.impersonate_get/post/...
|
||||
- cfspider.ImpersonateSession
|
||||
|
||||
快速开始:
|
||||
>>> import cfspider
|
||||
>>>
|
||||
@@ -16,28 +28,27 @@ CFspider - Cloudflare 代理 IP 池 Python 库
|
||||
>>> response = cfspider.get("https://httpbin.org/ip")
|
||||
>>> print(response.json())
|
||||
>>>
|
||||
>>> # 使用 Cloudflare Workers 代理
|
||||
>>> # 使用 VLESS 代理(需要 UUID)
|
||||
>>> response = cfspider.get(
|
||||
... "https://httpbin.org/ip",
|
||||
... cf_proxies="https://your-workers.dev"
|
||||
... cf_proxies="https://your-workers.dev",
|
||||
... uuid="your-uuid"
|
||||
... )
|
||||
>>> print(response.cf_colo) # Cloudflare 节点代码
|
||||
>>>
|
||||
>>> # 启用隐身模式(自动添加 15+ 浏览器请求头)
|
||||
>>> response = cfspider.get(
|
||||
... "https://example.com",
|
||||
... stealth=True,
|
||||
... stealth_browser='chrome'
|
||||
... )
|
||||
>>> # 异步请求(无需 UUID)
|
||||
>>> async with cfspider.AsyncSession(cf_proxies="https://your-workers.dev") as session:
|
||||
... response = await session.get("https://httpbin.org/ip")
|
||||
>>>
|
||||
>>> # TLS 指纹模拟
|
||||
>>> response = cfspider.get(
|
||||
>>> # TLS 指纹模拟(无需 UUID)
|
||||
>>> response = cfspider.impersonate_get(
|
||||
... "https://example.com",
|
||||
... impersonate="chrome131"
|
||||
... impersonate="chrome131",
|
||||
... cf_proxies="https://your-workers.dev"
|
||||
... )
|
||||
|
||||
版本信息:
|
||||
- 版本号: 1.8.0
|
||||
- 版本号: 1.8.6
|
||||
- 协议: Apache License 2.0
|
||||
- 文档: https://www.cfspider.com
|
||||
|
||||
|
||||
@@ -252,12 +252,14 @@ async def arequest(
|
||||
**kwargs
|
||||
) -> AsyncCFSpiderResponse:
|
||||
"""
|
||||
发送异步 HTTP 请求
|
||||
发送异步 HTTP 请求(无需 UUID)
|
||||
|
||||
使用 /proxy API 路由,无需提供 UUID。
|
||||
|
||||
Args:
|
||||
method: HTTP 方法
|
||||
url: 目标 URL
|
||||
cf_proxies: 代理地址(选填)
|
||||
cf_proxies: Workers 代理地址(选填,无需 UUID)
|
||||
- 当 cf_workers=True 时,填写 CFspider Workers 地址
|
||||
- 当 cf_workers=False 时,填写普通代理地址
|
||||
cf_workers: 是否使用 CFspider Workers API(默认 True)
|
||||
@@ -266,6 +268,10 @@ async def arequest(
|
||||
|
||||
Returns:
|
||||
AsyncCFSpiderResponse: 异步响应对象
|
||||
|
||||
Example:
|
||||
# 无需 UUID
|
||||
response = await cfspider.aget("https://httpbin.org/ip", cf_proxies="https://your-workers.dev")
|
||||
"""
|
||||
params = kwargs.pop("params", None)
|
||||
headers = kwargs.pop("headers", {})
|
||||
|
||||
@@ -13,14 +13,25 @@ from .async_api import AsyncCFSpiderResponse, AsyncStreamResponse
|
||||
|
||||
class AsyncSession:
|
||||
"""
|
||||
异步会话类
|
||||
异步会话类(无需 UUID)
|
||||
|
||||
提供可复用的 httpx.AsyncClient,支持 HTTP/2 和连接池。
|
||||
使用 /proxy API 路由,无需提供 UUID。
|
||||
|
||||
Note:
|
||||
- 基础使用:无需 UUID,直接使用
|
||||
- 双层代理 HTTP:支持 two_proxy 参数
|
||||
- 双层代理 HTTPS:请使用 cfspider.get() + uuid + two_proxy
|
||||
|
||||
Example:
|
||||
async with cfspider.AsyncSession(cf_proxies="workers.dev") as session:
|
||||
# 无需 UUID
|
||||
async with cfspider.AsyncSession(cf_proxies="https://your-workers.dev") as session:
|
||||
r1 = await session.get("https://example.com")
|
||||
r2 = await session.post("https://example.com", json={"key": "value"})
|
||||
|
||||
# 双层代理 (仅支持 HTTP)
|
||||
async with cfspider.AsyncSession(cf_proxies="...", two_proxy="host:port:user:pass") as session:
|
||||
r = await session.get("http://httpbin.org/ip") # 注意是 http://
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -91,13 +91,16 @@ def impersonate_request(
|
||||
**kwargs
|
||||
) -> ImpersonateResponse:
|
||||
"""
|
||||
使用 TLS 指纹模拟发送请求
|
||||
使用 TLS 指纹模拟发送请求(无需 UUID)
|
||||
|
||||
使用 /proxy API 路由,无需提供 UUID。
|
||||
支持 25+ 种浏览器指纹(Chrome、Safari、Firefox、Edge)。
|
||||
|
||||
Args:
|
||||
method: HTTP 方法
|
||||
url: 目标 URL
|
||||
impersonate: 浏览器指纹(如 chrome131, safari18_0, firefox133)
|
||||
cf_proxies: 代理地址(选填)
|
||||
cf_proxies: Workers 代理地址(选填,无需 UUID)
|
||||
cf_workers: 是否使用 CFspider Workers API(默认 True)
|
||||
**kwargs: 其他参数
|
||||
|
||||
@@ -105,7 +108,12 @@ def impersonate_request(
|
||||
ImpersonateResponse: 响应对象
|
||||
|
||||
Example:
|
||||
>>> response = cfspider.impersonate_get("https://example.com", impersonate="chrome131")
|
||||
# 无需 UUID,直接使用
|
||||
>>> response = cfspider.impersonate_get(
|
||||
... "https://example.com",
|
||||
... impersonate="chrome131",
|
||||
... cf_proxies="https://your-workers.dev" # 无需 UUID
|
||||
... )
|
||||
>>> print(response.text)
|
||||
"""
|
||||
curl_requests = _get_curl_cffi()
|
||||
|
||||
Reference in New Issue
Block a user