Skip to content
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

If there is way to specify the connection timeout #216

Open
lexabug opened this issue Jan 5, 2022 · 2 comments
Open

If there is way to specify the connection timeout #216

lexabug opened this issue Jan 5, 2022 · 2 comments

Comments

@lexabug
Copy link

lexabug commented Jan 5, 2022

Hi there.
For the feature I develop I'd like to specify the IMAP connection timeout, so the Imbox fails out after X seconds if it cannot establish connection with the host:port (for instance because of the firewall).
How that can be done?

@martinrusev
Copy link
Owner

martinrusev commented Jan 6, 2022

Hi @lexabug,
Not possible with the current version, but should not be too complicated to implement. The timeout parameter has to be added here: https://github.com/martinrusev/imbox/blob/master/imbox/imap.py#L18

It will work only in Python 3.9 and 3.10 though

https://docs.python.org/3/library/imaplib.html

@lexabug
Copy link
Author

lexabug commented Jan 6, 2022

In my project I'm bound to python v3.8 (hope we will upgrade soon). Looks like using socket.setdefaulttimeout is the way for me. Going to implement it as a context manger within my imbox wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants