Closed Ronserruya closed 12 months ago
Thanks for reporting the problem! I think this was actually a bug in the idna package that was fixed in version 3.3:
Throw IDNAError exception correctly for some malformed input
I get the error you see when I downgrade idna to version 3.2 (pip install idna==3.2
) but not after version 3.3 (pip install idna==3.3
. So updating idna probably will fix it.
When trying to parse domains with a bad punicode (at least as far as I can understand the error) The pkg fails to catch the underlying UnicodeError, raising it instead of wrapping it in a more understandable EmailSyntaxError
This is the relevant code: https://github.com/JoshData/python-email-validator/blob/main/email_validator/syntax.py#L434
I guess a better error would be
EmailSyntaxError("The part after the @-sign contains invalid punicode: ({e})")