Giter VIP home page Giter VIP logo

Comments (3)

bogdanteodoru avatar bogdanteodoru commented on May 31, 2024

@hubroot from what I see from their documentation the 429 code is when you hit the rate limiter.. ergo (HTTP 429 return code is used when breaking a request rate limit.)

Why would you want to retry if you hit that? Just implement your code in a way you don't hit the limiter.

from py3cw.

hubroot avatar hubroot commented on May 31, 2024

@bogdanteodoru yeah, i mean some internal check of the error code, if it's 429, the user can set their python code to get data from some cache.

Imagine you request the API accounts endpoint every 5 minutes, it's better to save at least the latest successful response in some kind of database or cache to keep the app working.

accounts = api.get('accounts', on_429_error= function(){ database.get('last saved account')}

from py3cw.

bogdanteodoru avatar bogdanteodoru commented on May 31, 2024

@hubroot you could easily store that on a local variable as well if you want to keep track of a previous state. I mean, it would be an extra step from your end, of course but I would rather inform you that you hit the limit. The caching itself can be done by a local fallback function or variable that actually doing it on the library.

I wouldn't implement this at the current point as I see it more flexible to use other caching libraries or just a state variable outside the library but if this will become a pain in the ass or requested by multiple people, I will reconsider.

I will close this for now. Thanks for your input.

from py3cw.

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.