python采集站点403postman正常

python采集站点403postman正常,第1张

python 使用requests get获取站点内容提示403,但是使用postman获取正常;
此时需要加上对应的header验证

headers = {
        'User-agent': "Mozilla 5.10",
        'cache-control': "no-cache"
    }
response = requests.get(url, headers=headers)
print(response.status_code)

可正常返回站点信息

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/917566.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存