Domains with underscores fail domain() check?
Closed this issue ยท 5 comments
Quix0r commented
I have found this domain: tfirefish_01.blueb.me and it fails:
from validators import domain
print(domain('google.com'))
print(domain('tfirefish_01.blueb.me'))Expected:
True
True
Current:
True
ValidationError(func=domain, args={'value': 'tfirefish_01.blueb.me'})
Python: 3.11.2
Validators: 0.28.0
yozachar commented
Please refer the documentation. Use rfc_2782=True:
validators.domain("tfirefish_01.blueb.me", rfc_2782=True)
Quix0r commented
Cannot this be configured or set once per script run? I have to then modify 14 script positions.
yozachar commented
Sorry, currently no. But you can achieve something similar using an environment variable.
Quix0r commented
Which one do I have to set? I checked the code and found no appearance?
yozachar commented
Well, you could create something like RFC_2782, and use it across your program. This might require one time edit on those 14 instances, but then you're good to go.