We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7e3daf commit 29ee837Copy full SHA for 29ee837
coc/errors.py
@@ -53,8 +53,14 @@ class HTTPException(ClashOfClansException):
53
__slots__ = ("response", "status", "message", "reason", "_data")
54
55
def _from_response(self, response, data):
56
- self.response = response
57
- self.status = response.status
+ if isinstance(response, int):
+ self.status = response
58
+ self.response = None
59
+ elif isinstance(response, ClientResponse):
60
+ self.response = response
61
+ self.status = response.status
62
+ else:
63
+ self.response = self.status = None
64
65
if isinstance(data, dict):
66
self.reason = data.get("reason", "Unknown")
@@ -73,7 +79,7 @@ def _from_response(self, response, data):
73
79
super().__init__(fmt.format(self))
74
80
75
81
def __init__(self, response=None, data=None):
76
- if isinstance(response, ClientResponse):
82
+ if isinstance(response, (ClientResponse, int)):
77
83
self._from_response(response, data)
78
84
else:
85
self.response = None
0 commit comments