From 54e001e9be5be5f1d711a2686f7d6808987f44c0 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 14 Sep 2016 14:09:13 +0200 Subject: rscalib/__init__.py: Don't set fp to None when raising an HTTPError, use io.StringIO() object instead. --- rscalib/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rscalib/__init__.py b/rscalib/__init__.py index 9c61844..92ac16c 100644 --- a/rscalib/__init__.py +++ b/rscalib/__init__.py @@ -14,7 +14,6 @@ import base64 import pycurl - class UserError(Exception): """An error message that should be presented to the user.""" @@ -131,8 +130,12 @@ class PycURLGetter: header_ = ''.join(lines[1:]) headers = parse_headers(BytesIO(header_.encode('ascii'))) raise urllib.error.HTTPError( - self.curl.getinfo(pycurl.EFFECTIVE_URL), status, - self.result.getvalue(), headers, None) + self.curl.getinfo(pycurl.EFFECTIVE_URL), + code=status, + msg=self.result.getvalue(), + hdrs=headers, + fp=StringIO() + ) class GetMazaData: -- cgit v1.2.3