Moment For Technology

Use oAuth verified Github API to avoid the problem of excessive call frequency

Posted on Nov. 27, 2023, 11:04 p.m. by Christopher Decker
Category: The back-end Tag: The back-end

Today I am going to develop a small tool that uses github Restful API to get all the issues in my repository:

Api.github.com/repos/i0424...

After executing, I can see from the response header x-Ratelimit-limit that the Restful API can only be called 60 times per hour. I have already called it twice, leaving 58 calls.

From the header field x-ratelimit-reset, we know that if all 60 times are used up, it will take an hour to recover.

Fortunately, Github also supports oAuth authentication to call these apis:

The NUMBER of API calls made through this authentication method skyrocketed to 5,000 per hour, which was pretty sweet.

For more of Jerry's original articles, please follow the public account "Wang Zixi ":

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.