mirror of
https://git.juggalol.com/agatha/gitmon.git
synced 2024-12-26 23:56:39 +00:00
Track rate limit reset and remaining
This commit is contained in:
parent
7503a8effe
commit
47e2bda181
@ -18,6 +18,10 @@ class GitHubApi:
|
||||
if proxy:
|
||||
self.session.proxies.update(proxy)
|
||||
|
||||
# Rate limits
|
||||
self.rate_reset = None
|
||||
self.rate_remaining = None
|
||||
|
||||
def __get(self, endpoint, params=None):
|
||||
"""GET an HTTP resource and return JSON."""
|
||||
url = self.base_url + endpoint
|
||||
@ -33,7 +37,8 @@ class GitHubApi:
|
||||
|
||||
def __parse_headers(self, headers):
|
||||
"""Parse headers to update rate limits."""
|
||||
pass
|
||||
self.rate_reset = int(headers['x-ratelimit-reset'])
|
||||
self.rate_remaining = int(headers['x-ratelimit-remaining'])
|
||||
|
||||
def get_events(self, page=None):
|
||||
"""Fetch GitHub events."""
|
||||
|
Loading…
Reference in New Issue
Block a user