You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
422 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from re import compile, sub
def domain_ok(domain):
domains = ["jet", "jw", "404", "dash", "awesome"]
if domain.count(".") == 1:
if domain.split(".")[1] in domains:
# ../some => some
# Защита от проверки папок выше, чем нужно и др.
regex = compile('[^a-zA-Zа-яА-ЯЁё.-]')
c_domain = regex.sub('', domain)
if domain == c_domain:
return domain
return False