code: def request_to_dict(self, request):
          '''
          Convert Request object to a dict.
          modified from scrapy.utils.reqser
          '''
          req_dict = {
              # urls should be safe (safe_string_url)
              'url': to_unicode(request.url),
              '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,
               #  callback/errback are assumed to be a bound instance of the spider
              'callback': None if request.callback is None else request.callback.__name__,
              'errback': None if request.errback is None else request.errback.__name__,
          }
          return req_dicf request_to_dict(self, request):
          '''
          Convert Request object to a dict.
          modified from scrapy.utils.reqser
          '''
          req_dict = {
              # urls should be safe (safe_string_url)
              'url': to_unicode(request.url),
              '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,
               #  callback/errback are assumed to be a bound instance of the spider
              'callback': None if request.callback is None else request.callback.__name__,
              'errback': None if request.errback is None else request.errback.__name__,
          }
          return req_dict
docs: Convert Request object to a dict.
          modified from scrapy.utils.reqser