返回【403】的應(yīng)對(duì)方法:設(shè)置請(qǐng)求頭里面的user-agent 和Referer參數(shù),代碼如下:
headers={
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3823.400 QQBrowser/10.7.4307.400",
"Upgrade-Insecure-Requests": "1",
"Referer":"http://www.htqyy.com"
}
html = requests.get(url,headers=headers)
[開(kāi)心]
承擔(dān)因您的行為而導(dǎo)致的法律責(zé)任,
本站有權(quán)保留或刪除有爭(zhēng)議評(píng)論。
參與本評(píng)論即表明您已經(jīng)閱讀并接受
上述條款。