Skip to content

Commit 24383b9

Browse files
authored
Merge pull request #665 from thebigbone/main
use HTTPStatus.OK instead of literal status code 200
2 parents d3b8300 + 89b9fb4 commit 24383b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

guardrails/validators/endpoint_is_reachable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from http import HTTPStatus
12
from typing import Any, Dict
23

34
from guardrails.logger import logger
@@ -31,7 +32,7 @@ def validate(self, value: Any, metadata: Dict) -> ValidationResult:
3132
# Check that the URL exists and can be reached
3233
try:
3334
response = requests.get(value)
34-
if response.status_code != 200:
35+
if response.status_code != HTTPStatus.OK:
3536
return FailResult(
3637
error_message=f"URL {value} returned "
3738
f"status code {response.status_code}",

0 commit comments

Comments
 (0)