Interview Prep/Python for DevOps/Data formats, HTTP & REST APIs

How do you respect API rate limits proactively?

AdvancedConceptData formats, HTTP & REST APIs
Answer
  • Read rate-limit headers (X-RateLimit-Remaining, X-RateLimit-Reset on GitHub; Retry-After on 429) and sleep until reset when near zero.
  • Bound concurrency (a fixed worker pool or asyncio.Semaphore), because parallelism multiplies request rate.
  • Use a token-bucket limiter for steady pacing (limits, aiolimiter, or a small class).
  • Cache responses (ETags with If-None-Match; GitHub does not count 304s against the limit).
  • Prefer bulk or GraphQL endpoints to reduce call count.
All Python for DevOps questions Roadmap: Python for automation

More on Data formats, HTTP & REST APIs