Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Helper functions for serializing (and deserializing) requests. """
"""Convert Request object to a dict.
If a spider is given, it will try to find out the name of the spider method used in the callback and store that as the callback. """ 'url': request.url.decode('ascii'), # urls should be safe (safe_string_url) 'callback': cb, 'errback': eb, 'method': request.method, 'headers': dict(request.headers), 'body': request.body, 'cookies': request.cookies, 'meta': request.meta, '_encoding': request._encoding, 'priority': request.priority, 'dont_filter': request.dont_filter, }
"""Create Request object from a dict.
If a spider is given, it will try to resolve the callbacks looking at the spider for methods with the same name. """ url=d['url'].encode('ascii'), callback=cb, errback=eb, method=d['method'], headers=d['headers'], body=d['body'], cookies=d['cookies'], meta=d['meta'], encoding=d['_encoding'], priority=d['priority'], dont_filter=d['dont_filter'])
else:
except AttributeError: raise ValueError("Method %r not found in: %s" % (name, obj)) |