scrapy添加请求头

在settings.py文件中直接添加

DEFAULT_REQUEST_HEADERS = {
    'accept': 'image/webp,*/*;q=0.8',
    'accept-language': 'zh-CN,zh;q=0.8',
    'referer': 'https://www.taobao.com/',
    'user-agent': 'Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36',
}

转载: https://blog.csdn.net/qq_24861509/article/details/48019629

猜你喜欢

转载自blog.csdn.net/qq_40258748/article/details/88679520