
from curl_cffi import requests

def test1():
    # 注意这个 impersonate 参数，指定了模拟哪个浏览器
    r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome101")

    print(r.json())

def test2():
    proxies={"http": "http://127.0.0.1:1080", "https": "http://127.0.0.1:1080"}
    r = requests.get("http://baidu.com",
                     proxies=proxies,
                     allow_redirects=False,
                     impersonate="chrome101"
                     )
    print(r.text)

def test3():
    headers = {
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
    }
    url = "http://baidu.com"
    # 注意这个 impersonate 参数，指定了模拟哪个浏览器
    response = requests.get(url, headers=headers, impersonate="chrome101")
    print(response.text)

test3()


