Skip to content

Commit

Permalink
Multiple fixes and updates (#349)
Browse files Browse the repository at this point in the history
* refreshed .gitignore for vscode.

* Adding support for VSCode, black, and standardizing settings.json.

* Added support for VSCode Dev Containers.

* Revert "Update playbyplay.py (#337)"

This reverts commit 5076fae. File updated should have been src/nba_api/live/nba/library/http.py.

* Version Bump. Updated Readme

* Change Log Update
  • Loading branch information
rsforbes authored Jun 13, 2023
1 parent 1eac7e2 commit 11280b4
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"containerEnv": {
"PYTHON_VERSION": "3.11",
"PYTHON_PATH": ""
},
"features": {
"ghcr.io/devcontainers/features/python:latest": {
"version": "3.11"
},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},
"image": "mcr.microsoft.com/devcontainers/base:debian",
"name": "nba_data",
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
"remoteEnv": {
"PYTHONUTF8": "1"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONSTRAINT_URL=https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt
pip install --upgrade pip
poetry install --no-root
# pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"
#(airflow standalone) &
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,11 @@ nba_api/library/debug/
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.formatOnSave": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"88"
],
"python.analysis.diagnosticSeverityOverrides": {
"reportUnboundVariable": "information",
"reportImplicitStringConcatenation": "warning",
"reportUntypedFunctionDecorator": "information",
}
}
19 changes: 19 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@

# Version History

## v1.2.1

Date: 2023-06-13

### Security
- [requests](https://github.com/psf/requests) bumped from 2.28.2 to 2.31.0 via #344 - @dependabot

### Fixed

- Reverted alexfayad@5076fae050ec7d655af300cde7674756c4381943. Change broke materialized url and test. Original URL was found to be valid.
- Resolved bad url in documentation #322 - @alexfayad
- Fixed typo in causing src/nba_api/stats/endpoints/playerindex.py to fail #340 - @shufinskiy
- Fixed expired Slack URL #347


### Developer Tools
- Support for VS Code Dev Containers (including auto-format via [black](https://github.com/psf/black))


## v1.2.0

Date: 2023-03-23
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "nba_api"
version = "1.2"
version = "1.2.1"
description = "An API Client package to access the APIs for NBA.com"
license = "MIT"
authors = [
Expand Down
4 changes: 2 additions & 2 deletions src/nba_api/live/nba/endpoints/playbyplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from nba_api.live.nba.library.http import NBALiveHTTP

class PlayByPlay(Endpoint):
endpoint_url = 'https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_{game_id}.json'
expected_data = {'meta': {'version': 1, 'code': 200, 'request': 'https://cdn.nba.com/static/json/liveData/playbyplay/playbyplay_0022000180.json', 'time': '2021-01-15 23:48:58.906160'}, 'game': {'gameId': '0022000180', 'actions': [{'actionNumber': 4, 'clock': 'PT11M58.00S', 'timeActual': '2021-01-16T00:40:31.3Z', 'period': 1, 'periodType': 'REGULAR', 'teamId': 1610612738, 'teamTricode': 'BOS', 'actionType': 'jumpball', 'subType': 'recovered', 'descriptor': 'startperiod', 'qualifiers': [], 'personId': 1629684, 'x': None, 'y': None, 'possession': 1610612738, 'scoreHome': '0', 'scoreAway': '0', 'edited': '2021-01-16T00:40:31Z', 'orderNumber': 40000, 'xLegacy': None, 'yLegacy': None, 'isFieldGoal': 0, 'jumpBallRecoveredName': 'G. Williams', 'jumpBallRecoverdPersonId': 1629684, 'side': None, 'playerName': 'Williams', 'playerNameI': 'G. Williams', 'personIdsFilter': [1629684, 202684, 202696], 'jumpBallWonPlayerName': 'Thompson', 'jumpBallWonPersonId': 202684, 'description': 'Jump Ball T. Thompson vs. N. Vucevic: Tip to G. Williams', 'jumpBallLostPlayerName': 'Vucevic', 'jumpBallLostPersonId': 202696}]}}
endpoint_url = 'playbyplay/playbyplay_{game_id}.json'
expected_data = {'meta': {'version': 1, 'code': 200, 'request': 'http://nba.cloud/games/0022000180/playbyplay?Format=json', 'time': '2021-01-15 23:48:58.906160'}, 'game': {'gameId': '0022000180', 'actions': [{'actionNumber': 4, 'clock': 'PT11M58.00S', 'timeActual': '2021-01-16T00:40:31.3Z', 'period': 1, 'periodType': 'REGULAR', 'teamId': 1610612738, 'teamTricode': 'BOS', 'actionType': 'jumpball', 'subType': 'recovered', 'descriptor': 'startperiod', 'qualifiers': [], 'personId': 1629684, 'x': None, 'y': None, 'possession': 1610612738, 'scoreHome': '0', 'scoreAway': '0', 'edited': '2021-01-16T00:40:31Z', 'orderNumber': 40000, 'xLegacy': None, 'yLegacy': None, 'isFieldGoal': 0, 'jumpBallRecoveredName': 'G. Williams', 'jumpBallRecoverdPersonId': 1629684, 'side': None, 'playerName': 'Williams', 'playerNameI': 'G. Williams', 'personIdsFilter': [1629684, 202684, 202696], 'jumpBallWonPlayerName': 'Thompson', 'jumpBallWonPersonId': 202684, 'description': 'Jump Ball T. Thompson vs. N. Vucevic: Tip to G. Williams', 'jumpBallLostPlayerName': 'Vucevic', 'jumpBallLostPersonId': 202696}]}}

#Data Sets
game = Endpoint.DataSet
Expand Down

0 comments on commit 11280b4

Please sign in to comment.