Use FastAPI instead of Django
This commit is contained in:
parent
bfe90aa69d
commit
b462be40af
43 changed files with 1105 additions and 1688 deletions
17
app/validators.py
Normal file
17
app/validators.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue