Compare commits
No commits in common. "47e2bda1812e41aa4cf93906d6a43db2927accc3" and "8a9200e62785718235823ca99aaf8eb2c9e3fd83" have entirely different histories.
47e2bda181
...
8a9200e627
@ -18,10 +18,6 @@ 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
|
||||
@ -37,8 +33,7 @@ class GitHubApi:
|
||||
|
||||
def __parse_headers(self, headers):
|
||||
"""Parse headers to update rate limits."""
|
||||
self.rate_reset = int(headers['x-ratelimit-reset'])
|
||||
self.rate_remaining = int(headers['x-ratelimit-remaining'])
|
||||
pass
|
||||
|
||||
def get_events(self, page=None):
|
||||
"""Fetch GitHub events."""
|
||||
|
10
main.py
10
main.py
@ -2,14 +2,6 @@
|
||||
from gitmon.api import GitHubApi
|
||||
|
||||
|
||||
def print_event(event):
|
||||
event_type = event.get('type')
|
||||
repo = event.get('repo')
|
||||
actor = event.get('actor')
|
||||
|
||||
print(f'{event_type}:\t{repo["name"]}, {actor["login"]}')
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
|
||||
@ -17,7 +9,7 @@ def main():
|
||||
|
||||
events = api.get_events()
|
||||
for event in events:
|
||||
print_event(event)
|
||||
print(event['type'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user