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

New feature : customize timeout duration #89

Open
louisgaume opened this issue Dec 19, 2023 · 2 comments
Open

New feature : customize timeout duration #89

louisgaume opened this issue Dec 19, 2023 · 2 comments

Comments

@louisgaume
Copy link

👋 Hello, we're super happy with this nice SDK !

We're just missing a small feature that would help us improving our performance. We would like to have the ability to customize the timeout of the API call being made. Customizing this parameter at a global level would be fine (for example like it's done within the PHP SDK)

If you're accepting this, we can provide a PR for this !

Let me know if you guys need anything !
Thanks in advance 😄

@JanEbbing
Copy link
Member

Hi @louisgaume , there is some functionality for this already, does it not cover your use case?
You can do the following

import deepl
deepl.http_client.min_connection_timeout = 5.0
translator = deepl.Translator('my_auth_key')  # Will use 5 second timeout

Please note that the library uses exponential backoff, so each consecutive retry will wait for longer - probably easiest to check the code to see what exactly happens under the hood.

See also this issue. This functionality is a bit hidden, we should definitely document it better, sorry. If it doesn't cover your use case, please elaborate.

@louisgaume
Copy link
Author

Hello ! Thanks for your reply, this might do the job for us in fact! Didn't know we could change this parameter this way. :)
I'll take a look again at the code deeply to see how is it working under the hood.

Thanks again :)

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