scrapy Request参数

转自
https://www.cnblogs.com/luolizhi/p/6821458.html

url: 就是需要请求,并进行下一步处理的url
callback: 指定该请求返回的Response,由那个函数来处理。
method: 一般不需要指定,使用默认GET方法请求即可
headers: 请求时,包含的头文件。一般不需要。内容一般如下:使用 urllib2 自己写过爬虫的肯定知道
        Host: media.readthedocs.org
        User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
        Accept: text/css,*/*;q=0.1
        Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
        Accept-Encoding: gzip, deflate
        Referer: http://scrapy-chs.readthedocs.org/zh_CN/0.24/
        Cookie: _ga=GA1.2.1612165614.1415584110;
        Connection: keep-alive
        If-Modified-Since: Mon, 25 Aug 2014 21:59:35 GMT
        Cache-Control: max-age=0
meta: 比较常用,在不同的请求之间传递数据使用的。字典dict型
        request_with_cookies = Request(url="http://www.example.com",
                                       cookies={'currency': 'USD', 'country': 'UY'},
                                       meta={'dont_merge_cookies': True})
encoding: 使用默认的 'utf-8' 就行。
dont_filter: indicates that this request should not be filtered by the scheduler.
             This is used when you want to perform an identical request multiple times,
             to ignore the duplicates filter. Use it with care, or you will get into crawling loops.
             Default to False.
errback: 指定错误处理函数
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值