Skip to content

Commit 9346c58

Browse files
committed
add-constants-file
1 parent 21838be commit 9346c58

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

fastpix/utilis/constants.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
11
BASE_URL = "https://v1.fastpix.io"
2+
3+
import re
4+
import uuid
5+
from typing import Any, Dict
6+
7+
def validate_uuid(uuid_str: str) -> bool:
8+
"""
9+
Validate if the given string is a valid UUID.
10+
11+
Args:
12+
uuid_str (str): The UUID string to validate
13+
14+
Returns:
15+
bool: True if valid UUID, False otherwise
16+
"""
17+
try:
18+
uuid_obj = uuid.UUID(uuid_str)
19+
return str(uuid_obj) == uuid_str
20+
except ValueError:
21+
return False
22+
23+
def validate_request_body(body: Dict[str, Any]) -> bool:
24+
"""
25+
Validate if the request body is a non-empty dictionary.
26+
27+
Args:
28+
body (Dict[str, Any]): The request body to validate
29+
30+
Returns:
31+
bool: True if valid request body, False otherwise
32+
"""
33+
return isinstance(body, dict) and len(body) > 0

0 commit comments

Comments
 (0)