3

I agree with the other answer by @Carcigenicate. Putting this into a loop instead of using a recursive design makes it a lot easier to understand. However, the explicit while loop can be simplified even further by using a for loop instead. This makes it even more readable, IMO. def get_request(self, end_point, max_attempts=20, retry_delay=3): """Get the ...


3

I know a possible suggestion is to make error handling more specific, given the requests library myriad exceptions, but I figured that any exception should just be handled by trying X amount of time and then quitting if it doesn't work. I disagree here. Not just any exception should be handled. It's possible to have typo'd a bug into your code inside the ...


2

I have never used Elixir in my life until seeing this question, so my feedback is very limited and I probably shouldn't be putting an answer on here. However, there are a few ways it could be simplified: the module lstat(path, opts \\ []) reads information about a path, returns a FileStat struct which has a type: field which can be type: :device | :...


2

The entire question essentially spins around and calls for a good "Retry/MaxRetry nextwork requests" strategy. And just for this we have a flexible and reach Retry configuration - urllib3.util.Retry, which in combination with well-known requests lib provides granular control over the conditions under which we retry a request. Among a bunch of options it ...


Only top voted, non community-wiki answers of a minimum length are eligible