Giter VIP home page Giter VIP logo

Comments (5)

jcass77 avatar jcass77 commented on September 14, 2024

Could be that this is something that should be handled in either urllib3 or requests (also see urllib3/urllib3#367)

from pydora.

mcrute avatar mcrute commented on September 14, 2024

These types of errors should be handled by the HTTPAdapter in RetryingSession, or at least that was the theory. I'll try subclassing that to provide better error handling for this case.

from pydora.

jcass77 avatar jcass77 commented on September 14, 2024

I've been hacking on something at https://github.com/jcass77/pydora/blob/709904df881b5d96bf13b1d592d64db1214aedb5/pandora/transport.py#L27-L83

It uses a generic retry decorator to retry the call if the specified exception(s) occur. It is not HTTP session aware at all, so not sure if it will be suitable as a retry handler.

@mcrute is this approach worth considering or would you prefer to handle it differently?

from pydora.

mcrute avatar mcrute commented on September 14, 2024

That seems like a pretty good approach. The API is already aware of login timeout exceptions and will retry those so unless there's some other class of error that can't be fixed with a retry this should work.

You may also be able to simplify the logic by using a while loop and decrementing an integer like:

retries_left = 10
while retries_left > 0:
   ... retry ...
   retries_left -= 1

from pydora.

mcrute avatar mcrute commented on September 14, 2024

Merged #31

from pydora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.