def request_callback(uri, method, body, headers): foo_header_regex = re.compile('X-foo: (.*?)\r\n') match = foo_header_regex.search(decode_utf8(headers)) result = "Response from {0} with body:'{1}' and headers:'{2}'".format( uri.full_url(), decode_utf8(body), match.groups()[0], ) return result
def request_callback(method, uri, headers): return "The {0} response from {1}".format(decode_utf8(method), uri)
def request_callback(uri, method, body, headers): return "The {0} response from {1}".format(decode_utf8(method), uri.full_url())
def request_callback(request, uri, headers): headers.update({'a':'b'}) return [418,headers,"The {0} response from {1}".format(decode_utf8(request.method), uri)]
def request_callback(request, uri, headers): return [200, headers,"The {0} response from {1}".format(decode_utf8(request.method), uri)]