diff options
author | Christopher Baines <mail@cbaines.net> | 2015-12-22 14:09:50 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2015-12-22 14:09:50 +0000 |
commit | dff63335f212d32d7c1a4bb5276f2d31f5995ea1 (patch) | |
tree | 4b32f426e18fec38cbfa9468d0dfc0cbf2279363 /dummyserver/handlers.py | |
parent | 2b3d330a120a16e97cecd5163b5d454dcfe38a2b (diff) | |
download | python-urllib3-upstream/1.13.1.tar python-urllib3-upstream/1.13.1.tar.gz |
Import python-urllib3_1.13.1.orig.tar.gzupstream/1.13.1upstream
Diffstat (limited to 'dummyserver/handlers.py')
-rw-r--r-- | dummyserver/handlers.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/dummyserver/handlers.py b/dummyserver/handlers.py index 43398cd..fb6f44f 100644 --- a/dummyserver/handlers.py +++ b/dummyserver/handlers.py @@ -28,8 +28,8 @@ class Response(object): def __call__(self, request_handler): status, reason = self.status.split(' ', 1) request_handler.set_status(int(status), reason) - for header,value in self.headers: - request_handler.add_header(header,value) + for header, value in self.headers: + request_handler.add_header(header, value) # chunked if isinstance(self.body, list): @@ -48,6 +48,7 @@ class Response(object): RETRY_TEST_NAMES = collections.defaultdict(int) + class TestingApp(RequestHandler): """ Simple app that performs various operations, useful for testing an HTTP @@ -136,8 +137,8 @@ class TestingApp(RequestHandler): files_ = request.files.get(param) if len(files_) != 1: - return Response("Expected 1 file for '%s', not %d" %(param, len(files_)), - status='400 Bad Request') + return Response("Expected 1 file for '%s', not %d" % (param, len(files_)), + status='400 Bad Request') file_ = files_[0] data = file_['body'] @@ -277,7 +278,7 @@ def _parse_header(line): value = p[i + 1:].strip() params.append((name, value)) params = email.utils.decode_params(params) - params.pop(0) # get rid of the dummy again + params.pop(0) # get rid of the dummy again pdict = {} for name, value in params: value = email.utils.collapse_rfc2231_value(value) |