Revision 21190887 astakosclient/astakosclient/__init__.py

b/astakosclient/astakosclient/__init__.py
145 145
            # Get the connection object
146 146
            with self.conn_class(self.netloc) as conn:
147 147
                # Send request
148
                (data, status) = \
148
                (message, data, status) = \
149 149
                    _do_request(conn, method, request_path, **kwargs)
150 150
        except Exception as err:
151 151
            self.logger.error("Failed to send request: %s" % repr(err))
......
154 154
        # Return
155 155
        self.logger.debug("Request returned with status %s" % status)
156 156
        if status == 400:
157
            raise BadRequest(data)
157
            raise BadRequest(message, data)
158 158
        elif status == 401:
159
            raise Unauthorized(data)
159
            raise Unauthorized(message, data)
160 160
        elif status == 403:
161
            raise Forbidden(data)
161
            raise Forbidden(message, data)
162 162
        elif status == 404:
163
            raise NotFound(data)
163
            raise NotFound(message, data)
164 164
        elif status < 200 or status >= 300:
165
            raise AstakosClientException(data, status)
165
            raise AstakosClientException(message, data, status)
166 166
        return simplejson.loads(unicode(data))
167 167

  
168 168
    # ------------------------
......
314 314
    length = response.getheader('content-length', None)
315 315
    data = response.read(length)
316 316
    status = int(response.status)
317
    return (data, status)
317
    message = response.reason
318
    return (message, data, status)

Also available in: Unified diff