MCPcopy Create free account
hub / github.com/bundesAPI/smard-api / ApiException

Class ApiException

python-client/deutschland/smard/exceptions.py:98–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98class ApiException(OpenApiException):
99 def __init__(self, status=None, reason=None, http_resp=None):
100 if http_resp:
101 self.status = http_resp.status
102 self.reason = http_resp.reason
103 self.body = http_resp.data
104 self.headers = http_resp.getheaders()
105 else:
106 self.status = status
107 self.reason = reason
108 self.body = None
109 self.headers = None
110
111 def __str__(self):
112 """Custom error messages for exception"""
113 error_message = "Status Code: {0}\n" "Reason: {1}\n".format(
114 self.status, self.reason
115 )
116 if self.headers:
117 error_message += "HTTP response headers: {0}\n".format(self.headers)
118
119 if self.body:
120 error_message += "HTTP response body: {0}\n".format(self.body)
121
122 return error_message
123
124
125class NotFoundException(ApiException):

Callers 1

requestMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected