Use FastAPI instead of Django

This commit is contained in:
Joakim Hellsén 2024-05-21 02:43:53 +02:00
commit b462be40af
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
43 changed files with 1105 additions and 1688 deletions

17
app/validators.py Normal file
View file

@ -0,0 +1,17 @@
from urllib.parse import ParseResult, urlparse
def uri_validator(url: str) -> bool:
"""Validate a URI.
Args:
url: The URI to validate.
Returns:
True if the URI is valid, False otherwise.
"""
try:
result: ParseResult = urlparse(url)
return all([result.scheme, result.netloc])
except AttributeError:
return False