File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -83,19 +83,22 @@ def post(
83
83
if response .status_code == 422 :
84
84
_parsed_response = parse_validation_response (response .json ())
85
85
raise ValueError (
86
- f"Validation error [{ response .status_code } ]:\n { _parsed_response } "
86
+ f"Validation error for ' { url } ' [{ response .status_code } ]:\n { _parsed_response } "
87
87
)
88
88
89
89
if response .status_code not in (200 , 201 , 409 ):
90
- raise RuntimeError (f"HTTP error [{ response .status_code } ]: { response .text } " )
90
+ raise RuntimeError (
91
+ f"HTTP error for '{ url } ' [{ response .status_code } ]: { response .text } "
92
+ )
91
93
92
94
return response
93
95
94
96
95
97
@retry (
96
98
wait = wait_exponential (multiplier = RETRY_MULTIPLIER , min = RETRY_MIN , max = RETRY_MAX ),
97
- # retry=retry_if_not_exception_message(match="Validation error"), # if validation failed no point in retrying
99
+ retry = retry_if_exception_type ( RuntimeError ),
98
100
stop = stop_after_attempt (RETRY_STOP ),
101
+ reraise = True ,
99
102
)
100
103
def put (
101
104
url : str ,
@@ -104,7 +107,7 @@ def put(
104
107
is_json : bool = True ,
105
108
timeout : int = DEFAULT_API_TIMEOUT ,
106
109
) -> requests .Response :
107
- """HTTP POST with retries
110
+ """HTTP PUT with retries
108
111
109
112
Parameters
110
113
----------
You can’t perform that action at this time.
0 commit comments