@router.get(config.get("base_url") + "/api/domain.json", response_class=JSONResponse)
def api_domain(domain: str):
+ if domain is None:
+ raise HTTPException(status_code=400, detail="Invalid request, parameter 'domain' missing")
+
# Tidy up domain name
- domain = tidyup.domain(domain)
+ domain = tidyup.domain(domain).encode("idna").decode("utf-8")
if not utils.is_domain_wanted(domain):
raise HTTPException(status_code=500, detail=f"domain='{domain}' is not wanted")
@router.get(config.get("base_url") + "/infos")
def rss(request: Request, domain: str):
+ if domain is None:
+ raise HTTPException(status_code=400, detail="Invalid request, parameter 'domain' missing")
+
# Tidy up domain name
- domain = tidyup.domain(domain)
+ domain = tidyup.domain(domain).encode("idna").decode("utf-8")
if not utils.is_domain_wanted(domain):
raise HTTPException(status_code=500, detail=f"domain='{domain}' is not wanted")
@router.get(config.get("base_url") + "/rss")
def rss(request: Request, domain: str = None):
if domain is not None:
- domain = tidyup.domain(domain)
+ domain = tidyup.domain(domain).encode("idna").decode("utf-8")
wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):])
punycode = domain.encode("idna").decode("utf-8")