Created
November 13, 2024 11:36
-
-
Save adgedenkers/8e9f2eaf4f1059afee3a2bc49ae80f74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BBallSchedule.py | |
# | |
# Author: AdgeDenkers | |
# created: 2024-10-28 | |
# updated: 2024-11-13 | |
# Version: 1.1 | |
# Note: Get the current dates event if any | |
import requests | |
from datetime import datetime | |
# Define the API endpoint and parameters | |
school_id = 159 | |
team_id = 58255 | |
api_url = f"https://www.schedulegalaxy.com/api/v1/schools/{school_id}/activities" | |
params = { | |
'team_id': team_id, | |
'from': datetime.now().strftime('%Y-%m-%d'), | |
'to': datetime.now().strftime('%Y-%m-%d'), | |
'type': 'all', | |
'per': 100 # Number of records per page | |
} | |
# Send a GET request to the API | |
response = requests.get(api_url, params=params) | |
# Check if the request was successful | |
if response.status_code == 200: | |
events = response.json().get('data', []) | |
if events: | |
print(f"Events for {datetime.now().strftime('%B %d, %Y')}:") | |
for event in events: | |
print(f"Title: {event['title']}") | |
print(f"Date: {event['date']}") | |
print(f"Start Time: {event['start_time']}") | |
print(f"End Time: {event['end_time']}") | |
print(f"Location: {event['location']}") | |
print(f"Link: {event['link']}") | |
print("-" * 40) | |
else: | |
print("No events scheduled for today.") | |
else: | |
print(f"Failed to retrieve events. Status code: {response.status_code}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment