ph_py
ph_py copied to clipboard
Adds code to deal with rate limits imposed by Product Hunt API
Each API response includes 3 rate limit headers. You can use these headers to check your current rate limit status.
- X-Rate-Limit-Limit: Your applications limit for the 15 minute period
- X-Rate-Limit-Remaining: Remaining allowed requests for the reset period
- X-Rate-Limit-Reset: Seconds until the rate limit is reset
The methods _update_time_limits is called at each request and updates
three new atributes of the class responsible for keeping track of these
three limits. The method get_rate_limits is used to acess these values
and wait_if_no_rate_limit_remaining wait the limit to be restabilished
before making a new request.