mirror of
https://git.juggalol.com/agatha/gitmon.git
synced 2024-11-22 07:26: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.
|
headers (dict): The response headers from the GitHub API.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.rate_reset = datetime.fromtimestamp(int(headers['x-ratelimit-reset']))
|
try:
|
||||||
self.rate_remaining = int(headers['x-ratelimit-remaining'])
|
self.rate_reset = datetime.fromtimestamp(int(headers['x-ratelimit-reset']))
|
||||||
logger.info(f'{self.rate_remaining} calls remaining until {self.rate_reset} ({self.rate_reset - datetime.now()})')
|
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):
|
def get_events(self, page=None):
|
||||||
"""Fetch GitHub events.
|
"""Fetch GitHub events.
|
||||||
|
Loading…
Reference in New Issue
Block a user