diff --git a/guardrails/validators/endpoint_is_reachable.py b/guardrails/validators/endpoint_is_reachable.py index c5fd33895..27853c990 100644 --- a/guardrails/validators/endpoint_is_reachable.py +++ b/guardrails/validators/endpoint_is_reachable.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict from guardrails.logger import logger @@ -31,7 +32,7 @@ def validate(self, value: Any, metadata: Dict) -> ValidationResult: # Check that the URL exists and can be reached try: response = requests.get(value) - if response.status_code != 200: + if response.status_code != HTTPStatus.OK: return FailResult( error_message=f"URL {value} returned " f"status code {response.status_code}",