Open kuchel77 opened 4 years ago
Is it better with #56 ?
from synology_dsm import SynologyDSM
print("Creating Valid API")
api = SynologyDSM("192.168.0.152", "5000", "mark", "pwd", False, timeout=30, debugmode=True)
That is essentially my test code above. My NAS was using 192.168.0.152 previously but once I got the network bonding and finalised setup it is now using 192.168.0.240. Changing the timeout just changes how long it takes to spit out the error above rather than handling any errors. I have no device using 192.168.0.152 to reply with a http status code or connection refused or anything similar.
There is a similar error if I point it to another server, that says connection refused on port 5000 with a whole lot of unhandled exceptions as well.
In the tests, if you had INVALID_HOST as well as VALID_HOST, it would show the same errors as above.
For my tests I was not in my local network (still not) so maybe that's why.
What do you mean by "not handled properly" ?
There is a SynologyDSMRequestException
but the issue is that it prints all the stack above ?
Do you have an idea on how to fix this ?
Eventually submit a PR if you can.
When using the example script, and putting in the details for my NAS which has been turned off, I am getting the following messages as the timeout exceptions haven't be properly handled in the code.
This also then impacts on Home Assistant using this, and this is filling the logs as well rather than a simple offline message.