48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
# import requests
|
|
from datetime import datetime
|
|
import json
|
|
|
|
# BASE_URL = "https://unstop.com/api/public/opportunity/search-result"
|
|
# PARAMS = {
|
|
# "opportunity": "hackathons",
|
|
# "oppstatus": "open",
|
|
# "per_page": "200",
|
|
# }
|
|
# HEADERS = {
|
|
# "User-Agent": (
|
|
# "Mozilla/5.0 (X11; Linux x86_64) "
|
|
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
# "Chrome/151.0.0.0 Safari/537.36"
|
|
# )
|
|
# }
|
|
#
|
|
# request_url = BASE_URL + "?" + "&".join(f"{k}={v}" for k, v in PARAMS.items())
|
|
# response = requests.get(request_url, headers=HEADERS)
|
|
#
|
|
# with open("unstop.json", "w", encoding="utf-8") as file:
|
|
# file.write(response.text)
|
|
#
|
|
# hackathons = response.json()["data"]["data"]
|
|
|
|
with open("unstop.json") as file:
|
|
hackathons = json.loads(file.read())["data"]["data"]
|
|
|
|
for hackathon in hackathons:
|
|
title = hackathon["title"]
|
|
org = hackathon["organisation"]["name"]
|
|
location = hackathon["address_with_country_logo"]["address"]
|
|
event_date = datetime.fromisoformat(hackathon["end_date"]).date()
|
|
reg_start = datetime.fromisoformat(
|
|
hackathon["regnRequirements"]["start_regn_dt"]
|
|
).date()
|
|
reg_end = datetime.fromisoformat(
|
|
hackathon["regnRequirements"]["end_regn_dt"]
|
|
).date()
|
|
|
|
print(title)
|
|
print(f"Organization: {org}")
|
|
print(f"Location: {location}")
|
|
print(f"Event Date: {event_date}")
|
|
print(f"Registration: {reg_start} - {reg_end}")
|
|
print()
|