question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reduce API request number for API call limitation reasons.

See original GitHub issue

Hi, After reading your lib, I appreciate your contribution to an easy, fast Google SpreadSheet API. I saw in class SpreadSheet, you call every single spreadsheets.get for every single function get_workspace. I think you should update all of workspace metadata in __init__ method of SpreadSheet class for reducing call gg API.

Thanks again

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
lavigne958commented, Dec 7, 2021

I checked the methods you mention, yes we call the method fetch_sheet_metadata each time. But in the case of __init__ we only keep the properties section and in the other cases we only keep the sheet section.

We could keep the list of sheets from the sheet section in the __init__ but gspread is asyncrhonous and does not handle concurrency. So if we get the list of sheets at __init__ and later try to get a sheet, it might have change, it might not exists anymore. This is why when you request a specific sheet using get_worksheet or worksheet we must call the API again and retrieve the latest informations.

This is why we can’t cache the response from the GET request.

1reaction
lavigne958commented, Dec 3, 2021

Hello @sandl99 ,

Thabk you very much we are happy that you like gspread.

I don’t understand what’s you mean sorry, you mention workspaces but we don’t have such objects, do you mean worksheets?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle API rate limits: Do your integrations work at ...
Typically, rate-limit algorithms track the number of requests over a short period of time, such as one second or one minute. If requests...
Read more >
Best practices for avoiding rate limiting | Zendesk Developer ...
Reducing the number of API requests · Optimize your code to eliminate any unnecessary API calls. · Cache frequently used data. · Sideload...
Read more >
Everything You Need To Know About API Rate Limiting
Best Practices For API Rate Limiting · Are requests throttled when they exceed the limit? · Do new calls and requests incur additional...
Read more >
How to avoid hitting rate limits in API integration - Elastic.io
We'll go through different API rate limiting techniques as well as strategies and workarounds to recover from them or generally avoid them.
Read more >
Limits and Quotas on API Requests | Analytics Core Reporting ...
If the quota of requesting a Google Analytics API is exceeded, the API returns an error code 403 or 429 and a message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found