@@ -83,7 +83,7 @@ def _handle_success(
83
83
return model_class (decoded_body ) # type: ignore
84
84
85
85
def _exception_for_error (
86
- self , status : int , content_type : str , raw_body : str , uri : str
86
+ self , status : int , content_type : Optional [ str ] , raw_body : str , uri : str
87
87
) -> Union [
88
88
AuthenticationError ,
89
89
InsufficientFundsError ,
@@ -100,7 +100,7 @@ def _exception_for_error(
100
100
return self ._exception_for_unexpected_status (status , raw_body , uri )
101
101
102
102
def _exception_for_4xx_status (
103
- self , status : int , content_type : str , raw_body : str , uri : str
103
+ self , status : int , content_type : Optional [ str ] , raw_body : str , uri : str
104
104
) -> Union [
105
105
AuthenticationError ,
106
106
InsufficientFundsError ,
@@ -113,7 +113,7 @@ def _exception_for_4xx_status(
113
113
return HTTPError (
114
114
f"Received a { status } error with no body" , status , uri , raw_body
115
115
)
116
- if content_type .find ("json" ) == - 1 :
116
+ if content_type is None or content_type .find ("json" ) == - 1 :
117
117
return HTTPError (
118
118
f"Received a { status } with the following body: { raw_body } " ,
119
119
status ,
0 commit comments