MCPcopy Create free account
hub / github.com/apache/mesos / MesosHTTPException

Class MesosHTTPException

src/python/lib/mesos/exceptions.py:36–64  ·  view source on GitHub ↗

A wrapper around Response objects for HTTP error codes. :param response: requests Response object :type response: Response

Source from the content-addressed store, hash-verified

34
35
36class MesosHTTPException(MesosException):
37 """
38 A wrapper around Response objects for HTTP error codes.
39
40 :param response: requests Response object
41 :type response: Response
42 """
43 STATUS_CODE = None
44
45 def __init__(self, response):
46 super(MesosHTTPException, self).__init__()
47 self.response = response
48
49 def status(self):
50 """
51 Return status code from response.
52
53 :return: status code
54 :rtype: int
55 """
56 if self.STATUS_CODE is None:
57 return self.response.status_code
58 return self.STATUS_CODE
59
60 def __str__(self):
61 return "The url '{url}' returned HTTP {status_code}: {text}"\
62 .format(url=self.response.request.url,
63 status_code=self.response.status_code,
64 text=self.response.text)
65
66
67class MesosAuthenticationException(MesosHTTPException):

Callers 1

_requestMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected