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

try/except blocks for connection error to prevent script from stopping #31

Closed
wants to merge 1 commit into from

Conversation

rjkerrison
Copy link

To prevent the script from stopping during times of poor connectivity, we catch any ConnectionError or similar and retry the current step after 60 seconds.

@rbignon
Copy link
Owner

rbignon commented May 23, 2021

Hello,

Thank you for your patch. However, I would like to find a way to use the retry mechanism of requests to prevent try/except on each request.

Also, why waiting 60 seconds and not only something like 5 seconds?

@nicolaus-hee
Copy link
Contributor

On a similar note, I noticed that some url queries take (~3x) longer than woob's standard timeout and added self.TIMEOUT = 60 to class Doctolib(LoginBrowser) > def __init__().

@rbignon
Copy link
Owner

rbignon commented May 23, 2021

The problem is that I had to replace the default woob Session (which handles timeouts and retries) by the cloudscrape one (to bypass cloudflare protections), but this one does not support giving max_retries on HTTPAdapter.

@rjkerrison
Copy link
Author

For my use case, I had intermittent wifi and waiting 5 seconds would result in a lot of unnecessary attempts, whereas waiting 60 seconds was just two or three attempts. Without this retrying, the script would fail for me after around an hour, but with it I was able to find my appointment over a few hours. (On that note, thank you so much!)

@clemux
Copy link
Contributor

clemux commented May 23, 2021

What do you think of rollbacking the timeout changes here, and opening an issue/PR for the addition of a --timeout option?

@rjkerrison
Copy link
Author

Closing this as no longer presents a problem in the latest version

@rjkerrison rjkerrison closed this Dec 13, 2021
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

Successfully merging this pull request may close these issues.

None yet

4 participants