猿人学第17题

import httpx
headers = {
    "user-agent": "yuanrenxue.project",
    "x-requested-with": "XMLHttpRequest"
}
cookies = {
    "Hm_lvt_0362c7a08a9a04ccf3a8463c590e1e2f": "1676117858,1676119019,1676204003",
    "sessionid": "vd4ttss39x1s21oqlqsggjumztxnpg93",
    "Hm_lvt_9bcbda9cbf86757998a2339a0437208e": "1676455128,1676508335,1676535590,1676552480",
    "Hm_lvt_c99546cf032aaa5a679230de9a95c7db": "1676455128,1676508335,1676535590,1676552480",
    "Hm_lpvt_9bcbda9cbf86757998a2339a0437208e": "1676552506",
    "qpfccr": "true",
    "no-alert3": "true",
    "Hm_lpvt_c99546cf032aaa5a679230de9a95c7db": "1676552541"
}
url = "https://match.yuanrenxue.com/api/match/17"
s=0
for page in range(1,6):
    params = {
        "page": f"{page}"
    }
    with httpx.Client(headers=headers,cookies=cookies,params=params, http2=True) as client:
        response = client.get(url)
        result = response.json()
        print(result['data'])
        for li in result['data']:
            s+=li['value']
print(s)

 

posted @ 2023-02-16 21:27  小纱雾  阅读(66)  评论(0)    收藏  举报