diff --git a/ozgursozluk/utils.py b/ozgursozluk/utils.py index 237fe8a..dabfc09 100644 --- a/ozgursozluk/utils.py +++ b/ozgursozluk/utils.py @@ -1,5 +1,7 @@ from datetime import datetime, timedelta +import requests + def last_commit() -> str: """Return the last commit ID.""" @@ -12,3 +14,14 @@ def expires() -> datetime: """One year later.""" return datetime.now() + timedelta(days=365) + + +def contributors() -> list: + """Get GitHub contributors.""" + + request = requests.get( + "https://api.github.com/repos/beucismis/ozgursozluk/contributors" + ) + + for contributor in request.json(): + yield {"username": contributor["login"], "commit": contributor["contributions"]}