From 26e9f870a3d6aea1c7ff4d576d9b38e3b4d5bbbc Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 6 Feb 2017 09:54:05 -0500 Subject: Remove the dependency on httplib2. Closes #42 --- src/mailman/testing/documentation.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/mailman/testing/documentation.py') diff --git a/src/mailman/testing/documentation.py b/src/mailman/testing/documentation.py index 33678a7d0..fc75e7a93 100644 --- a/src/mailman/testing/documentation.py +++ b/src/mailman/testing/documentation.py @@ -92,8 +92,17 @@ def call_http(url, data=None, method=None, username=None, password=None): """ content, response = call_api(url, data, method, username, password) if content is None: - for header in sorted(response): - print('{}: {}'.format(header, response[header])) + # We used to use httplib2 here, which included the status code in the + # response headers in the `status` key. requests doesn't do this, but + # the doctests expect it so for backward compatibility, include the + # status code in the printed response. + headers = dict(status=response.status_code) + headers.update({ + field.lower(): response.headers[field] + for field in response.headers + }) + for field in sorted(headers): + print('{}: {}'.format(field, headers[field])) return None return content -- cgit v1.2.3-70-g09d2