发送请求函数

main
phmycqkit 2 months ago
parent 1494128e84
commit dcd06171a1

@ -0,0 +1,18 @@
import requests
def GetRespond(url, data):
"""发送请求
- url: 请求网址
- data: 请求参数
"""
# 模拟游览器
headers = {
# Cookie 用户信息,常用于检测是否有登陆账号
"Cookie": "b_nut=1655303638; CURRENT_BLACKGAP=0; i-wanna-go-back=-1; buvid_fp_plain=undefined; buvid3=136172B5-8F7E-42EF-90C5-2D4A04147EE8167644infoc; LIVE_BUVID=AUTO3016558277732131; is-2022-channel=1; DedeUserID=17012171; DedeUserID__ckMd5=f518907167c48789; buvid4=88DCF3D1-502C-06D9-BF49-B7E4F0A0519315466-022061522-P1wwgn5lZ%2FpHMTaSvipifA%3D%3D; rpdid=|(JlRYJ~Ykl)0J'u~|JulJkJm; b_ut=5; FEED_LIVE_VERSION=V_HEADER_LIVE_NO_POP; _uuid=10525FA4C-8522-AFCC-210B4-19DE77B6FC8C66067infoc; enable_web_push=DISABLE; header_theme_version=CLOSE; CURRENT_FNVAL=16; fingerprint=913be879852fe07606cd36fdc205d010; CURRENT_QUALITY=116; home_feed_column=5; SESSDATA=02073d74%2C1741791214%2C27f68%2A92CjCmgDH-jkOm_SxUtVJFNLtOJeIP0b8hsAHsHrrFFZfOBISh6cYei3G1uSHUdK8BsdASVmRNelVZU29kZ2tWTk5iY05vWXJnSk9ZcVF5d0RmOUdKbGVWVEg2dmFGMXZsVmNEMUNRVnR0cUxyNXdWWlh5eXN6NFBPakh2M1puVjYzUFJ4T2cyWVBnIIEC; bili_jct=f29317e8f0203187c9bcec98ac9bbd30; PVID=2; browser_resolution=1707-837; buvid_fp=913be879852fe07606cd36fdc205d010; bili_ticket=eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY1ODE3NTksImlhdCI6MTcyNjMyMjQ5OSwicGx0IjotMX0.gM_SG7dtVNHO6JWzjJQb9TKfMdYUCQCc5kwBCvwvLTg; bili_ticket_expires=1726581699; b_lsid=A381C4D2_191F9C4B633; sid=8hmdz3e3; bp_t_offset_17012171=977684498172870656",
# User-Agent 用户代理,表示游览器基本身份信息/设备信息
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0"
}
# 发送请求
respond = request.get(url = url, params = data, headers = headers)
# 返回内容
return respond
Loading…
Cancel
Save