#NEWLINE# def request_to_dict( request , spider = None ) : #NEWLINE# #INDENT# 'Convert Request object to a dict.\n\n    If a spider is given, it will try to find out the name of the spider method\n    used in the callback and store that as the callback.\n    ' #NEWLINE# cb = request . callback #NEWLINE# if callable ( cb ) : #NEWLINE# #INDENT# cb = _find_method ( spider , cb ) #NEWLINE# #UNINDENT# eb = request . errback #NEWLINE# if callable ( eb ) : #NEWLINE# #INDENT# eb = _find_method ( spider , eb ) #NEWLINE# #UNINDENT# d = { #NEWLINE# #INDENT# 'url' : to_unicode ( request . url ) , #NEWLINE# 'callback' : cb , #NEWLINE# 'errback' : eb , #NEWLINE# 'method' : request . method , #NEWLINE# 'headers' : dict ( request . headers ) , #NEWLINE# 'body' : request . body , #NEWLINE# 'cookies' : request . cookies , #NEWLINE# 'meta' : request . meta , #NEWLINE# '_encoding' : request . _encoding , #NEWLINE# 'priority' : request . priority , #NEWLINE# 'dont_filter' : request . dont_filter , #NEWLINE# #UNINDENT# } #NEWLINE# return d