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

Convenient request max retries setup #87

Closed
lukasz-staniszewski opened this issue Nov 24, 2023 · 4 comments
Closed

Convenient request max retries setup #87

lukasz-staniszewski opened this issue Nov 24, 2023 · 4 comments

Comments

@lukasz-staniszewski
Copy link

Hello,

are there any plans to allow setting a maximum number of request retries in deepl.Translator() args? Or is there any convenient way I can do it by myself without touching the library code?

@JanEbbing
Copy link
Member

Hi, you can configure this by changing the max_network_retries value in deepl.http_client (definition here). Note that it only retries transient errors.

We should probably add this to the README...

@lukasz-staniszewski
Copy link
Author

Thanks for your response!

Yeah, but it involves changing the library code, which I would prefer not to do. I've seen that the php implementation supports specifying timeout more conveniently, hence I hoped for that.

@JanEbbing
Copy link
Member

What do you mean by "changing the library code"? You can use it like this in your application code:

import deepl
deepl.http_client.max_network_retries = 2
translator = deepl.Translator('my_auth_key')  # Will use 2 retries

@lukasz-staniszewski
Copy link
Author

Yeah, you are entirely right, sorry for my misunderstanding. Thank you for your help!

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