feat: add api aggregations
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# response = requests.get(
|
||||
# "https://devnovate.co/api/v1/events",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# with open("devnovate.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
|
||||
with open("devnovate.json") as file:
|
||||
hackathons = json.loads(file.read())
|
||||
|
||||
for hackathon in hackathons:
|
||||
if (
|
||||
hackathon["registrationStatus"] != "OPEN"
|
||||
or hackathon["name"] == "test"
|
||||
or (
|
||||
hackathon["eventType"] != "hackathon"
|
||||
and "hackathon" not in hackathon["name"]
|
||||
and "hackathon" not in hackathon["subtitle"]
|
||||
)
|
||||
):
|
||||
continue
|
||||
|
||||
name = hackathon["name"]
|
||||
location = hackathon["location"]
|
||||
event_date = hackathon["startDate"]
|
||||
reg_end = datetime.fromisoformat(hackathon["registrationDeadline"])
|
||||
|
||||
if reg_end.timestamp() < datetime.now().timestamp():
|
||||
continue
|
||||
|
||||
print(name)
|
||||
print(f"Location: {location}")
|
||||
print(f"Event Date: {event_date}")
|
||||
print(f"Registration End: {reg_end.date()}")
|
||||
print()
|
||||
Reference in New Issue
Block a user