-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typings and error handling - use your library in Home Assistant #260
Comments
hi there, thanks for reaching out. If someone sends a PR for type hints and/or improved error handling, that would be great! Or I could add this within the next few weeks. Using those more fine grained exception classes would certainly be an improvement. Currently there is just a single PywhoisError exception type. |
@richardpenman thank you for the reply. I'm not a Python developer but I can try to add error handling
I'm not sure if creating a class like https://github.com/mboot-github/WhoisDomain/blob/master/whoisdomain/domain.py will be enough. |
OK, I'll add some type hints and different exception classes, then see what the feedback is. |
I've started adding something (Misiu@e1e90df) but I don't feel too comfortable at adding types. I'm going to take a look at the tests and will get back here with my findings, generally, when trying to parse datetime, there is no error, and you return text as it is. When I tried to add an proper error, some tests failed, for example with |
I have added type hints. |
I've added some errors and fixed the date parsing a bit. |
@Misiu this is an excellent improvement - thanks very much for working on this! Did you want to send this as a PR now or first work on the other exceptions like WhoisQuotaExceeded? |
@richardpenman PR created - #267 I've tried my best to make this backward compatible. The errors extend |
I'm trying to replace the old and unsupported
whois
package with your package in Home Assistant (home-assistant/core#135297), but I got a comment against it - home-assistant/core#135297 (review)Your library was used before and was replaced with the currently unsupported library back in 2022 - home-assistant/core#63227
I would like to hear your opinion about adding typing and error handling to your package.
I saw a helper class that was calling your package and it throws more error based on the response - https://github.com/mkrasowski/homeassistant-core/blob/replace-unmaintained-whois-library/homeassistant/components/whois/helper.py#L36
Is adding exceptions like https://github.com/mboot-github/WhoisDomain/blob/master/whoisdomain/exceptions.py an option?
Sadly the current whois integration in Home Assistant doesn't work well for PL domains (and probably other domains) and doesn't return the expiration date.
The text was updated successfully, but these errors were encountered: