mirror of
https://git.juggalol.com/agatha/gitmon.git
synced 2024-11-21 15:06:41 +00:00
Handle KeyErrors in __parse_headers. Closes #9
This commit is contained in:
parent
e4a153d385
commit
1e958b397a
@ -72,9 +72,12 @@ class GitHubApi:
|
||||
headers (dict): The response headers from the GitHub API.
|
||||
|
||||
"""
|
||||
self.rate_reset = datetime.fromtimestamp(int(headers['x-ratelimit-reset']))
|
||||
self.rate_remaining = int(headers['x-ratelimit-remaining'])
|
||||
logger.info(f'{self.rate_remaining} calls remaining until {self.rate_reset} ({self.rate_reset - datetime.now()})')
|
||||
try:
|
||||
self.rate_reset = datetime.fromtimestamp(int(headers['x-ratelimit-reset']))
|
||||
self.rate_remaining = int(headers['x-ratelimit-remaining'])
|
||||
logger.info(f'{self.rate_remaining} calls remaining until {self.rate_reset} ({self.rate_reset - datetime.now()})')
|
||||
except KeyError as e:
|
||||
logger.warning(f'Could not parse headers: {str(e)}')
|
||||
|
||||
def get_events(self, page=None):
|
||||
"""Fetch GitHub events.
|
||||
|
Loading…
Reference in New Issue
Block a user