diff --git a/oss_stats/cli.py b/oss_stats/cli.py index 6cb4f01..1d70342 100644 --- a/oss_stats/cli.py +++ b/oss_stats/cli.py @@ -25,14 +25,12 @@ retrieve_saved_latest_updates, ) -LOGO = """ - __ - / _| - __ _ ___ _ __ ___ ___ ___ _ _| |_ ___ ___ ___ - / _` |/ __| '_ ` _ \\ / __/ __| | | | _/ _ \\/ __/ __| -| (_| | (__| | | | | | (__\\__ \\ |_| | || (_) \\__ \\__ \\ - \\__,_|\\___|_| |_| |_|\\___|___/\\__,_|_| \\___/|___/___/ - +LOGO = r""" + / _| + __ _ ___ _ __ ___ ___ ___ _ _| |_ ___ ___ ___ + / _` |/ __| '_ ` _ \ / __/ __| | | | _/ _ \/ __/ __| +| (_| | (__| | | | | | (__\__ \ |_| | || (_) \__ \__ \ + \__,_|\___|_| |_| |_|\___|___/\__,_|_| \___/|___/___/ """ console = Console() diff --git a/oss_stats/stats.py b/oss_stats/stats.py index d3d2ad7..49f3bba 100644 --- a/oss_stats/stats.py +++ b/oss_stats/stats.py @@ -1,4 +1,5 @@ import os +import sys from typing import List from github import Github, GithubException from dotenv import load_dotenv @@ -21,12 +22,17 @@ token = os.getenv("GITHUB_TOKEN") if not token: - raise Exception("No token present!") + print("Please set your github token!") + sys.exit(1) gh = Github(token) org = "acmcsufoss" -repos = gh.get_organization(org).get_repos(sort="updated") +try: + repos = gh.get_organization(org).get_repos(sort="updated") +except GithubException as e: + print(f"GitHub API Error: {e.data.get('message', str(e))}") + sys.exit(1) six_months_ago = datetime.now(timezone.utc) - timedelta(days=182)