-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
adding connection timeout in secs with default value 10 secs #179
adding connection timeout in secs with default value 10 secs #179
Conversation
skoky
commented
Feb 23, 2024
- adding connection timeout when opening socket to the device as an optional value with default 10 secs. Relates to Add support for timeout parameter on device connection #171
- small code formatting. Sorry for that, my IDE insists on this
- please add or review python code / sample if we maybe need to describe it in more details
Thank you for this. It's a handy addition. Regarding usability, I would prefer if this were an optional function call rather than a mandatory parameter. Something like this should be a better user experience: let device = ApiClient::new(tapo_username, tapo_password)?
.set_timeout(timeout_secs) // <- optional usage
.p100(ip_address)
.await?;
|
Yes, you are right, its probably more clean usage as you describe. But its much more difficult to implement as the In the current |
I updated one python example |
I went ahead and did the refactor. It was a pain indeed, as you've assumed it would be. But it was worth it, as it enabled me to get rid of a After a rebase from the main, adding a |
25437b5
to
576853e
Compare
I have rebased to your latest main. I feel i broke it. Let me analyze this in more details |
I updated the rust API. Not sure how we can test python code to make sure it works. Do you like way of Rust and Python API is designed now? |
Nice. This is a lot more ergonomic. The Python wrapper has examples that can be run like this. |
I followed you style of setting params. Let me know if it make sense |
Shouldn't the Python wrapper follow the same behavior of the Rust API with the |
I think that the timeout param has a default value and may not be used. Its a standard pattern in Python. But if you want to change it, feel free to do it. |
How is this pull request coming along? I would really like to see this feature as soon as possible. Let me know if I can help somewhere by contributing to this issue |
Sorry for the long delay; work got in the way. |
25393c7
to
a9fdd53
Compare
@mihai-dinculescu thanks for merging. Can you please release new version with python as well? I wish to have it in my project. Thanks |
It's been released. |