INNER CODE UNIT · Python
make_headers
1837620622/cloudflare-bypass-2026 · bypass_curl_cffi.py:67
def make_headers(user_agent: str, fingerprint: str) -> Dict[str, str]:
"""生成与所选指纹大致匹配的请求头"""
headers = {
"User-Agent": user_agent,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Cache-Control": "no-cache",
"Pragma": "no-cache",
"Upgrade-Insecure-Requests": "1",
}
if fingerprint.startswith("chrome") or fingerprint.startswith("edge"):
ver = "120"
for token in ("146", "142", "136", "131", "124", "120", "101"):
if token in fingerprint:
ver = token
break
brand = "Microsoft Edge" if fingerprint.startswith("edge") else "Google Chrome"