class Httplib2Client(object): def __init__(self, cookiejar, rse): self.cookiejar = cookiejar self._raise_service_error = rse self.httpclient = CookiefulHttp(cookiejar=self.cookiejar) def __call__(self, url, method, body, headers): try: resp, content = self.httpclient.request(url, method=method, body=body, headers=headers) if resp.status != 200: self._raise_service_error(url, resp.status, resp["content-type"], content) except socket.error, e: self.log.error("SOCKET FAILURE: %s", e.fp.read()) raise MetawebError, "failed contacting %s: %s" % (url, str(e)) except httplib2.HttpLib2ErrorWithResponse, e: self._raise_service_error(url, resp.status, resp["content-type"], content)
class Httplib2Client(object): def __init__(self, cookiejar, rse): self.cookiejar = cookiejar self._raise_service_error = rse self.httpclient = CookiefulHttp(cookiejar=self.cookiejar) def __call__(self, url, method, body, headers): try: resp, content = self.httpclient.request(url, method=method, body=body, headers=headers) if (resp.status != 200): self._raise_service_error(url, resp.status, resp['content-type'], content) except socket.error, e: self.log.error('SOCKET FAILURE: %s', e.fp.read()) raise MetawebError, 'failed contacting %s: %s' % (url, str(e)) except httplib2.HttpLib2ErrorWithResponse, e: self._raise_service_error(url, resp.status, resp['content-type'], content)
def __init__(self, cookiejar, rse): self.cookiejar = cookiejar self._raise_service_error = rse self.httpclient = CookiefulHttp(cookiejar=self.cookiejar)