A free and open source alternative ekşi sözlük front-end
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
ozgursozluk/ozgursozluk/utils.py

31 lines
710 B

from datetime import datetime, timedelta
import requests
def expires() -> datetime:
"""One year later."""
return datetime.now() + timedelta(days=365)
async def last_commit() -> str:
"""Return the last commit ID."""
request = await requests.get("https://api.github.com/repos/beucismis/ozgursozluk/commits")
return request.json()[0]["sha"]
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"],
"total-commit": contributor["contributions"],
}