mirror of
https://github.com/YunoHost/check-http.git
synced 2024-09-03 19:56:42 +02:00
[enh] check domain validity
This commit is contained in:
parent
b833a795ce
commit
ae4da946d6
2 changed files with 6 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
|||
sanic
|
||||
aiohttp
|
||||
validators
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import aiohttp
|
||||
import validators
|
||||
|
||||
from sanic import Sanic
|
||||
from sanic.log import logger
|
||||
|
@ -27,6 +28,10 @@ async def check_http(request):
|
|||
|
||||
domain = data["domain"]
|
||||
|
||||
if not validators.domain(domain):
|
||||
logger.info(f"Invalid request, is not in the right format (domain is : {domain})")
|
||||
return json_response({"status": "error", "content": "domain is not in the right format (do not include http:// or https://)"})
|
||||
|
||||
# TODO DNS check
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
|
|
Loading…
Reference in a new issue