2File in charge of containing the boilerplate functions for checking if a given status corresponds to the expected response.
5from requests
import Response
10 This is the class in charge of checking if a response corresponds to a given status.
18 This function is in charge of getting the status code from the response.
20 response (Response): _description_: The response from the server.
22 int: _description_: The status code from the response.
24 return response.status_code
29 """ send_continue: 100 """
34 """ switching_protocols: 101 """
39 """ processing: 102 """
44 """ early_hints: 103 """
49 """ response_is_stale: 110 """
55 def success(self, response: Response) -> bool:
60 def created(self, response: Response) -> bool:
65 def accepted(self, response: Response) -> bool:
71 """ non_authoritative_information: 203 """
76 """ no_content: 204 """
81 """ reset_content: 205 """
86 """ partial_content: 206 """
91 """ multi_status: 207 """
96 """ already_reported: 208 """
100 def im_used(self, response: Response) -> bool:
105 """ 3xx redirection """
108 """ multiple_choices: 300 """
113 """ moved_permanently: 301 """
117 def found(self, response: Response) -> bool:
123 """ see_other: 303 """
128 """ not_modified: 304 """
133 """ use_proxy: 305 """
138 """ switch_proxy: 306 """
143 """ temporary_redirect: 307 """
148 """ permanent_redirect: 308 """
152 """ 4xx client error """
155 """ bad_request: 400 """
160 """ unauthorized: 401 """
165 """ payment_required: 402 """
170 """ forbidden: 403 """
175 """ not_found: 404 """
180 """ method_not_allowed: 405 """
185 """ not_acceptable: 406 """
190 """ proxy_authentication_required: 407 """
195 """ request_timeout: 408 """
200 """ conflict: 409 """
204 def gone(self, response: Response) -> bool:
210 """ length_required: 411 """
215 """ precondition_failed: 412 """
220 """ payload_too_large: 413 """
225 """ uri_too_long: 414 """
230 """ unsupported_media_type: 415 """
235 """ range_not_satisfiable: 416 """
240 """ expectation_failed: 417 """
245 """ im_a_teapot: 418 """
250 """ page_expired: 419 """
255 """ enhance_your_calm: 420 """
260 """ misdirected_request: 421 """
265 """ unprocessable_entity: 422 """
269 def locked(self, response: Response) -> bool:
275 """ failed_dependency: 424 """
280 """ too_early: 425 """
285 """ upgrade_required: 426 """
290 """ precondition_required: 428 """
295 """ too_many_requests: 429 """
300 """ request_header_fields_too_large: 431 """
305 """ unavailable_for_legal_reasons: 451 """
310 """ invalid_token: 498 """
314 """ 5xx server error"""
316 def internal_server_error(self, response: Response) -> bool:
317 """ internal_server_error: 500 """
318 status = self._get_status(response)
321 def not_implemented(self, response: Response) -> bool:
322 """ not_implemented: 501 """
323 status = self._get_status(response)
326 def bad_gateway(self, response: Response) -> bool:
327 """ bad_gateway: 502 """
328 status = self._get_status(response)
331 def service_unavailable(self, response: Response) -> bool:
332 """ service_unavailable: 503 """
333 status = self._get_status(response)
336 def gateway_timeout(self, response: Response) -> bool:
337 """ gateway_timeout: 504 """
338 status = self._get_status(response)
341 def http_version_not_supported(self, response: Response) -> bool:
342 """ http_version_not_supported: 505 """
343 status = self._get_status(response)
346 def variant_also_negotiates(self, response: Response) -> bool:
347 """ variant_also_negotiates: 506 """
348 status = self._get_status(response)
351 def insufficient_storage(self, response: Response) -> bool:
352 """ insufficient_storage: 507 """
353 status = self._get_status(response)
356 def loop_detected(self, response: Response) -> bool:
357 """ loop_detected: 508 """
358 status = self._get_status(response)
361 def bandwidth_limit_exceeded(self, response: Response) -> bool:
362 """ bandwidth_limit_exceeded: 509 """
363 status = self._get_status(response)
366 def not_extended(self, response: Response) -> bool:
367 """ not_extended: 510 """
368 status = self._get_status(response)
371 def network_authentication_required(self, response: Response) -> bool:
372 """ network_authentication_required: 511 """
373 status = self._get_status(response)
bool expectation_failed(self, Response response)
bool send_continue(self, Response response)
bool too_early(self, Response response)
bool request_header_fields_too_large(self, Response response)
bool precondition_failed(self, Response response)
int _get_status(self, Response response)
bool invalid_token(self, Response response)
bool forbidden(self, Response response)
bool multi_status(self, Response response)
bool unsupported_media_type(self, Response response)
bool failed_dependency(self, Response response)
bool uri_too_long(self, Response response)
bool unauthorized(self, Response response)
bool locked(self, Response response)
bool moved_permanently(self, Response response)
bool not_acceptable(self, Response response)
bool precondition_required(self, Response response)
bool partial_content(self, Response response)
bool already_reported(self, Response response)
bool gone(self, Response response)
bool response_is_stale(self, Response response)
bool method_not_allowed(self, Response response)
bool processing(self, Response response)
bool proxy_authentication_required(self, Response response)
bool payload_too_large(self, Response response)
bool misdirected_request(self, Response response)
bool non_authoritative_information(self, Response response)
bool range_not_satisfiable(self, Response response)
bool request_timeout(self, Response response)
bool conflict(self, Response response)
bool unavailable_for_legal_reasons(self, Response response)
bool enhance_your_calm(self, Response response)
bool payment_required(self, Response response)
bool switch_proxy(self, Response response)
bool upgrade_required(self, Response response)
bool switching_protocols(self, Response response)
bool im_a_teapot(self, Response response)
bool temporary_redirect(self, Response response)
bool too_many_requests(self, Response response)
bool use_proxy(self, Response response)
bool length_required(self, Response response)
bool bad_request(self, Response response)
bool page_expired(self, Response response)
bool success(self, Response response)
bool no_content(self, Response response)
bool permanent_redirect(self, Response response)
bool unprocessable_entity(self, Response response)
bool found(self, Response response)
bool multiple_choices(self, Response response)
bool see_other(self, Response response)
bool not_found(self, Response response)
bool im_used(self, Response response)
bool not_modified(self, Response response)
bool created(self, Response response)
bool accepted(self, Response response)
bool reset_content(self, Response response)
bool early_hints(self, Response response)