1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

fix python3 compat

This commit is contained in:
Kevin McCarthy
2014-05-03 20:37:53 -10:00
parent d1a3ab56b1
commit 1e8e7057f5
2 changed files with 7 additions and 8 deletions

View File

@@ -28,12 +28,11 @@ def get_header_items(message):
def get_headers(response):
if six.PY3:
header_list = response.msg._headers
return [b': '.join((k.encode('utf-8'), v.encode('utf-8'))) + b'\r\n'
for k, v in header_list]
else:
return response.msg.headers
for key in response.msg.keys():
if six.PY3:
yield key, response.msg.get_all(key)
else:
yield key, response.msg.getheaders(key)
def get_httpmessage(headers):