import tls_client
session = tls_client.Session(
client_identifier="chrome_120",
random_tls_extension_order=True
)
请求图片地址(示例)
image_url = "https://httpbin.org/image/jpeg"
response = session.get(image_url,)
print(response.text)
检查响应状态
if response.status_code == 200:
with open("image.jpg", "wb") as f:
f.write(response.content)
print("图片已保存为 image.jpg")
else:
print(f"请求失败,状态码:{response.status_code}")