scrapy中的ruquest
1. scrapy.Request 对象 和 requests.get()
1 class Request(object_ref): 2 3 def __init__(self, url, callback=None, method='GET', headers=None, body=None, 4 cookies=None, meta=None, encoding='utf-8', priority=0, 5 dont_filter=False, errback=None, flags=None): 6 7 self._encoding = encoding # this one has to be set first 8 self.method = str(method).upper() 9 self._set_url(url) 10 self._set_body(body) 11 assert isinstance(priority, int), "Request priority not an integer: %r" % priority 12 self.priority = priority 13 14 assert callback or not errback, "Cannot use errback without a callback" 15 self.callback = callback 16 self.errback = errback 17 18 self.cookies = cookies or {} 19 self.headers = Headers(headers or {}, encoding=encoding) 20 self.dont_filter = dont_filter 21 22 self._meta = dict(meta) if meta else None 23 self.flags = [] if flags is None else list(flags)