russellvt / hockey-info Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dword4/hockey-info
Flask app that utilizes the NHL API.
This project forked from dword4/hockey-info
Flask app that utilizes the NHL API.
Why this statically configures team abbreviations and names is "weird" and "unknown" (these are exposed via the NHL API, directly).
But, for now, this should be fixed/addressed. As an enhancement, static team names should be removed completely, and obtained from the NHL site, itself.
Seems you can't just "upgrade" the arrow
package:
[2023-05-01 06:43:27,508] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "~/projects/hockey/hockey-info/app/__init__.py", line 49, in show_playoffs
if get_season_status() == "P":
File "~/projects/hockey/hockey-info/app/__init__.py", line 87, in get_season_status
if goat.timestamp > arrow_seasonEnd:
TypeError: '>' not supported between instances of 'method' and 'method'
Following the upgrade to Flask2 (See flask2 branch / commit ae7dcca), it seems we have other "code breaks."
...
2023-04-27
2023-04-28
2023-04-29
[2023-04-29 06:26:13,608] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "~/projects/hockey/hockey-info/app.py", line 46, in show_playoffs
playoff_msg.append({'matchup': series['names']['matchupShortName'], 'status': series['currentGame']['seriesSummary']['seriesStatus']})
KeyError: 'seriesStatus'
172.16.72.181 - - [29/Apr/2023 06:26:13] "GET / HTTP/1.1" 500 -
[2023-04-29 06:26:14,498] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "~/projects/hockey/hockey-info/app.py", line 20, in favicon
return send_from_directory(os.apth.join(app.root_path, 'static'),
NameError: name 'os' is not defined
I suspect that the first issue (ie. when data is imported) is due to a lack of data for "today," which hasn't yet happened (ie. missing/expected data).
The second issue appears to be a typo that's somehow not previously been "found" (previously unreachable code path, or uncommon issue - possibly due to the previous missing data?)
This package should pass basic pylint
tests, prior to enabling the workflow.
Fresh install using Python 3.9.16
, Flask 1.0.2
and Jinja2 3.1.2
.
Complains that Markup is not in jinja2.
(venv-hockey) russell@host:~/projects/hockey/hockey-info$ flask run --host=0.0.0.0
Traceback (most recent call last):
File "~/projects/hockey/hockey-info/venv-hockey/bin/flask", line 5, in <module>
from flask.cli import main
File "~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (~/projects/hockey/hockey-info/venv-hockey/lib/python3.9/site-packages/jinja2/__init__.py)
(venv-hockey) russell@host:~/projects/hockey/hockey-info$ python --version
Python 3.9.16
(venv-hockey) russell@host:~/projects/hockey/hockey-info$ pip freeze
arrow==0.13.1
certifi==2022.12.7
chardet==3.0.4
click==8.1.3
Flask==1.0.2
gunicorn==20.1.0
idna==2.8
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
python-dateutil==2.8.2
requests==2.21.0
requests-cache==0.4.13
six==1.16.0
urllib3==1.24.3
Werkzeug==2.3.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.