@@ -14,10 +14,10 @@ def __init__(self, metadata, response):
1414 self .response = response
1515 self .tag = metadata ['tags' ][0 ]
1616 self .operation = metadata ['operation' ]
17- self .status = self .response .status_code if self .response .status_code else None
18- self .reason = self .response .reason if self .response .reason else None
17+ self .status = self .response .status_code if self .response is not None and self . response .status_code else None
18+ self .reason = self .response .reason if self .response is not None and self . response .reason else None
1919 try :
20- self .message = self .response .json () if self .response .json () else None
20+ self .message = self .response .json () if self .response is not None and self . response .json () else None
2121 except ValueError :
2222 self .message = self .response .text [:100 ]
2323 super (APIError , self ).__init__ (f'{ self .tag } , { self .operation } - { self .status } { self .reason } , { self .message } ' )
@@ -31,10 +31,10 @@ def __init__(self, metadata, response, message):
3131 self .response = response
3232 self .tag = metadata ['tags' ][0 ]
3333 self .operation = metadata ['operation' ]
34- self .status = self .response .status if self .response .status else None
35- self .reason = self .response .reason if self .response .reason else None
34+ self .status = self .response .status if self .response is not None and self . response .status else None
35+ self .reason = self .response .reason if self .response is not None and self . response .reason else None
3636 try :
37- self .message = self .response .json () if self .response .json () else None
37+ self .message = self .response .json () if self .response is not None and self . response .json () else None
3838 except ValueError :
3939 self .message = self .response .text [:100 ]
4040 super ().__init__ (
0 commit comments