Simple Python script to display live NHL scores in the terminal, fetched directly from the official NHL API.
requests
library
Install dependencies with:
pip install -r requirements.txt
Alternatively, install requests
directly with:
pip install requests
After installing dependencies, run the script with:
macOS/Linux:
python3 nhlscores.py
Windows:
python nhlscores.py
Set the score update interval (default: 30 seconds):
--update_interval SECONDS
Example: Update scores every 10 seconds:
python nhlscores.py --update_interval 10
Using a virtual environment is highly recommended to avoid conflicts with other Python projects.
Note: The venv module requires Python 3.3 or higher.
-
Setting Up venv and Installing Dependencies
macOS/Linux:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt deactivate
Windows:
python -m venv venv .\venv\Scripts\activate pip install -r requirements.txt deactivate
-
Running the Script
macOS/Linux:
source venv/bin/activate python3 nhlscores.py deactivate
Windows:
.\venv\Scripts\activate python nhlscores.py deactivate
- Hold Alt and drag the
nhlscores.py
file to the desktop to create a shortcut. - Right-click the shortcut, select properties and modify the Target field to:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoExit -Command "cd 'X:\YOUR PATH TO FILE\'; .\.venv\Scripts\Activate; python .\nhlscores.py"
Replace X:\YOUR PATH TO FILE\
with the actual path to the folder containing nhlscores.py