diff --git a/rewrite-httppy-pycurl-requests-0.30.patch b/rewrite-httppy-pycurl-requests-0.30.patch index 4707128..f778cba 100644 --- a/rewrite-httppy-pycurl-requests-0.30.patch +++ b/rewrite-httppy-pycurl-requests-0.30.patch @@ -1,4 +1,4 @@ -From 17ce6bb8e691560fb05b9ffbca5b1b42fef2f350 Mon Sep 17 00:00:00 2001 +From 22936cd8ed0f0d5b0c3ece75752e2877f46af455 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 21 Sep 2016 13:48:07 +0000 Subject: [PATCH 1/3] Rewrite http.py to use python-requests @@ -8,11 +8,11 @@ rpm is, as used by koji-containerbuild. Signed-off-by: Patrick Uiterwijk --- - osbs/http.py | 291 +++++++++-------------------------------------------------- - 1 file changed, 42 insertions(+), 249 deletions(-) + osbs/http.py | 290 +++++++++-------------------------------------------------- + 1 file changed, 42 insertions(+), 248 deletions(-) diff --git a/osbs/http.py b/osbs/http.py -index 9955c55..48b29d5 100644 +index 9955c55..5f39141 100644 --- a/osbs/http.py +++ b/osbs/http.py @@ -24,77 +24,17 @@ @@ -122,7 +122,7 @@ index 9955c55..48b29d5 100644 raise OsbsException(cause=ex, traceback=sys.exc_info()[2]) -@@ -160,203 +87,69 @@ def __init__(self, url, method, data=None, kerberos_auth=False, +@@ -160,203 +87,68 @@ def __init__(self, url, method, data=None, kerberos_auth=False, self.status_code = 0 self.headers = None @@ -265,7 +265,6 @@ index 9955c55..48b29d5 100644 - def _any_data_received(self): - return self.response_buffer.tell() != 0 + args['stream'] = True -+ headers['Cache-Control'] = 'no-cache' + + args['headers'] = headers + self.req = requests.request(method, url, **args) @@ -360,7 +359,7 @@ index 9955c55..48b29d5 100644 self.closed = True def __del__(self): -@@ -376,7 +169,7 @@ def __init__(self, status_code, headers, content): +@@ -376,7 +168,9 @@ def __init__(self, status_code, headers, content): self.content = content def json(self, check=True): @@ -368,10 +367,11 @@ index 9955c55..48b29d5 100644 + if check and self.status_code not in (0, requests.codes.OK, requests.codes.CREATED): raise OsbsResponseException(self.content, self.status_code) -- return json.loads(self.content) -+ return json.loads(self.content.decode('utf-8')) ++ if isinstance(self.content, bytes): ++ self.content = self.content.decode('utf-8') + return json.loads(self.content) -From 25242ca1696a8507ae392da3f55cddfc4d736c93 Mon Sep 17 00:00:00 2001 +From b626346936a0cd12cdaed028152311f70afcdc41 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 21 Sep 2016 14:13:25 +0000 Subject: [PATCH 2/3] Fix tests for porting of http client to requests @@ -462,7 +462,7 @@ index 674f9eb..30d2f14 100644 - finally: - HttpStream._perform = orig_perform -From e29a9b43caa51701986f74606c0ee79f90dc00c1 Mon Sep 17 00:00:00 2001 +From cdd2061d6397e159bb32413b39e538be7685b505 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 21 Sep 2016 14:27:16 +0000 Subject: [PATCH 3/3] Update spec file to include python-requests