Commit c41d4ef1 authored by Łukasz Nowak's avatar Łukasz Nowak

recurls: Enforce proper headers type

http.client.HTTPMessage is required for proper header setup.
parent f3e12dd6
...@@ -5,6 +5,7 @@ import subprocess ...@@ -5,6 +5,7 @@ import subprocess
from requests.structures import CaseInsensitiveDict from requests.structures import CaseInsensitiveDict
import gzip import gzip
import os import os
import http.client
class RecurlsResponse(object): class RecurlsResponse(object):
...@@ -88,7 +89,9 @@ class Recurls(object): ...@@ -88,7 +89,9 @@ class Recurls(object):
elif isinstance(verify, str): elif isinstance(verify, str):
command_list.extend(['--cacert', verify]) command_list.extend(['--cacert', verify])
if headers is None: if headers is None:
headers = {} headers = http.client.HTTPMessage()
else:
assert isinstance(headers, http.client.HTTPMessage)
with open(request_header_file, 'w') as fh: with open(request_header_file, 'w') as fh:
for header, value in headers.items(): for header, value in headers.items():
fh.write('%s: %s\n' % (header, value)) fh.write('%s: %s\n' % (header, value))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment