Tweak the webfinger resolution
This commit is contained in:
parent
d90e489fc6
commit
06f4f824d8
4 changed files with 52 additions and 30 deletions
|
@ -9,6 +9,10 @@ from . import strtobool
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InvalidURLError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def is_url_valid(url: str) -> bool:
|
||||
parsed = urlparse(url)
|
||||
if parsed.scheme not in ['http', 'https']:
|
||||
|
@ -33,3 +37,10 @@ def is_url_valid(url: str) -> bool:
|
|||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def check_url(url: str) -> None:
|
||||
if not is_url_valid(url):
|
||||
raise InvalidURLError(f'"{url}" is invalid')
|
||||
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue