From 3558b1c1543ba0c7322bf84ca45e4fb65688b7c1 Mon Sep 17 00:00:00 2001
From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com>
Date: Tue, 19 Sep 2023 19:15:12 -0500
Subject: [PATCH 1/4] script update
---
nba_data/nba_scraper_shot_chart.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/nba_data/nba_scraper_shot_chart.py b/nba_data/nba_scraper_shot_chart.py
index fc94fd8..c24bc48 100644
--- a/nba_data/nba_scraper_shot_chart.py
+++ b/nba_data/nba_scraper_shot_chart.py
@@ -12,10 +12,11 @@ django.setup()
from nba_data.models import PlayerShotChartData
-player_name = 'James Harden'
-season = 2010
-# team = 'LAL' # You might want to find a way to get this from the webpage
-url = 'https://www.basketball-reference.com/players/h/hardeja01/shooting/' + \
+player_name = 'Damian Lillard'
+season = 2013
+
+# Player name and season will be inserted into DB. Modify before running script.
+url = 'https://www.basketball-reference.com/players/l/lillada01/shooting/' + \
str(season)
response = requests.get(url)
From 0701ef19d2ba573cc602742d24d0a92ea29bdae6 Mon Sep 17 00:00:00 2001
From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com>
Date: Wed, 20 Sep 2023 00:00:01 -0500
Subject: [PATCH 2/4] usage and readme
---
README.md | 51 ++++++++++++++++++++++++++-------------------------
USAGE.md | 5 +++++
2 files changed, 31 insertions(+), 25 deletions(-)
create mode 100644 USAGE.md
diff --git a/README.md b/README.md
index 6daf3fc..bd42e92 100644
--- a/README.md
+++ b/README.md
@@ -8,29 +8,27 @@ This documentation provides the necessary information to use the NBA Stats API.
# [View API Documentation](https://documenter.getpostman.com/view/24232555/2s93shzpR3)
-
-
---
-
### Base URL
All URLs referenced in this documentation use the following base URL:
-> https://nba-stats-db.herokuapp.com/
+>
### Endpoints
Top 20 Scorers by Season
Method: `Get`
-> https://nba-stats-db.herokuapp.com/api/playerdata/topscorers/total/season/2023/
+>
Success Response:
`Code: 200`
Content:
+
```
{
"count": 20,
@@ -101,22 +99,23 @@ Content:
"team": "PHI",
"season": 2023
},
- ...
- ]
-}
+ ...
+ ]
+}
```
Top 20 Scorers in Playoffs
Method: `Get`
-> https://nba-stats-db.herokuapp.com/api/playerdata/topscorers/playoffs/2022/
+>
Success Response:
`Code: 200`
Content:
+
```
{
"count": 20,
@@ -187,22 +186,23 @@ Content:
"team": "GSW",
"season": 2022
},
- ...
- ]
-}
+ ...
+ ]
+}
```
Top 20 Assists by Season
Method: `Get`
-> https://nba-stats-db.herokuapp.com/api/top_assists/totals/2023/
+>
Success Response:
`Code: 200`
Content:
+
```
{
"count": 20,
@@ -273,23 +273,23 @@ Content:
"team": "DEN",
"season": 2023
},
- ...
- ]
-}
+ ...
+ ]
+}
```
Top 20 Assists in Playoffs
Method: `Get`
-> https://nba-stats-db.herokuapp.com/api/top_assists/playoffs/2022/
-
+>
Success Response:
`Code: 200`
Content:
+
```
{
"count": 20,
@@ -360,22 +360,23 @@ Content:
"team": "GSW",
"season": 2022
},
- ...
- ]
-}
+ ...
+ ]
+}
```
Top 20 Rebounders (Total Rebounds) by Season
Method: `Get`
-> https://nba-stats-db.herokuapp.com/api/top_rebounds/totals/2023/
+>
Success Response:
`Code: 200`
Content:
+
```
{
"count": 20,
@@ -446,9 +447,9 @@ Content:
"team": "CHI",
"season": 2023
},
- ...
- ]
-}
+ ...
+ ]
+}
```
diff --git a/USAGE.md b/USAGE.md
new file mode 100644
index 0000000..5a0fbf2
--- /dev/null
+++ b/USAGE.md
@@ -0,0 +1,5 @@
+# Activate Python Shell
+
+```
+source venv/bin/activate
+```
From 4b1d07353da3150eb5e5606383cf9b82c3d70686 Mon Sep 17 00:00:00 2001
From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com>
Date: Wed, 20 Sep 2023 01:08:57 -0500
Subject: [PATCH 3/4] 2009 done
---
nba_data/nba_scraper_advanced.py | 1 +
nba_data/nba_scraper_playoffs_advanced.py | 4 ----
nba_data/nba_scraper_playoffs_totals.py | 3 ---
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/nba_data/nba_scraper_advanced.py b/nba_data/nba_scraper_advanced.py
index 2e7ed4b..27babf5 100644
--- a/nba_data/nba_scraper_advanced.py
+++ b/nba_data/nba_scraper_advanced.py
@@ -28,6 +28,7 @@ from nba_data.models import PlayerAdvancedData
# Change LAC to SDC for 1984 and prior.
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
+
season = input('What season? ')
for team in teams:
diff --git a/nba_data/nba_scraper_playoffs_advanced.py b/nba_data/nba_scraper_playoffs_advanced.py
index 9bb8fc4..5b4eb68 100644
--- a/nba_data/nba_scraper_playoffs_advanced.py
+++ b/nba_data/nba_scraper_playoffs_advanced.py
@@ -29,10 +29,6 @@ from nba_data.models import PlayerPlayoffAdvancedData
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
-teams2 = ['HOU' ,'PHI', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
-
-team_abbreviations = ['ATL', 'BOS', 'BRK', 'CHI', 'CHO', 'CLE', 'DAL', 'DEN', 'DET', 'GSW', 'HOU', 'IND', 'LAC', 'LAL', 'MEM', 'MIA', 'MIL', 'MIN', 'NOP', 'NYK', 'OKC', 'ORL', 'PHI', 'PHO', 'POR', 'SAC', 'SAS', 'TOR', 'UTA', 'WAS']
-
season = input('What season? ')
for team in teams:
diff --git a/nba_data/nba_scraper_playoffs_totals.py b/nba_data/nba_scraper_playoffs_totals.py
index 47853ff..1470ce7 100644
--- a/nba_data/nba_scraper_playoffs_totals.py
+++ b/nba_data/nba_scraper_playoffs_totals.py
@@ -29,9 +29,6 @@ from nba_data.models import PlayerPlayoffTotalsData
teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
-
-team_abbreviations = ['ATL', 'BOS', 'BRK', 'CHI', 'CHO', 'CLE', 'DAL', 'DEN', 'DET', 'GSW', 'HOU', 'IND', 'LAC', 'LAL', 'MEM', 'MIA', 'MIL', 'MIN', 'NOP', 'NYK', 'OKC', 'ORL', 'PHI', 'PHO', 'POR', 'SAC', 'SAS', 'TOR', 'UTA', 'WAS']
-
season = input('What season? ')
for team in teams:
From 5eaa50f4e7b3b7addf0db2a1e08d8c342a33ce59 Mon Sep 17 00:00:00 2001
From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com>
Date: Wed, 20 Sep 2023 02:33:13 -0500
Subject: [PATCH 4/4] central teams list
---
nba_data/data.py | 1 +
nba_data/nba_scraper_advanced.py | 5 +++--
nba_data/nba_scraper_playoffs_advanced.py | 5 ++++-
nba_data/nba_scraper_playoffs_totals.py | 5 +++--
nba_data/nba_scraper_totals.py | 5 +++--
5 files changed, 14 insertions(+), 7 deletions(-)
create mode 100644 nba_data/data.py
diff --git a/nba_data/data.py b/nba_data/data.py
new file mode 100644
index 0000000..c18e70b
--- /dev/null
+++ b/nba_data/data.py
@@ -0,0 +1 @@
+teams_data = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOK', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
\ No newline at end of file
diff --git a/nba_data/nba_scraper_advanced.py b/nba_data/nba_scraper_advanced.py
index 27babf5..74e7786 100644
--- a/nba_data/nba_scraper_advanced.py
+++ b/nba_data/nba_scraper_advanced.py
@@ -6,6 +6,7 @@ from bs4 import BeautifulSoup
import csv
import json
import time
+from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -27,11 +28,11 @@ from nba_data.models import PlayerAdvancedData
# Change MEM to VAN for 2001 and prior.
# Change LAC to SDC for 1984 and prior.
-teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
+teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
season = input('What season? ')
-for team in teams:
+for team in teams_data:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make)
diff --git a/nba_data/nba_scraper_playoffs_advanced.py b/nba_data/nba_scraper_playoffs_advanced.py
index 5b4eb68..52a8dc7 100644
--- a/nba_data/nba_scraper_playoffs_advanced.py
+++ b/nba_data/nba_scraper_playoffs_advanced.py
@@ -6,6 +6,7 @@ from bs4 import BeautifulSoup
import csv
import json
import time
+from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -31,7 +32,9 @@ teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', '
season = input('What season? ')
-for team in teams:
+teams2 = 'PHI'
+
+for team in teams2:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make)
diff --git a/nba_data/nba_scraper_playoffs_totals.py b/nba_data/nba_scraper_playoffs_totals.py
index 1470ce7..fb002a4 100644
--- a/nba_data/nba_scraper_playoffs_totals.py
+++ b/nba_data/nba_scraper_playoffs_totals.py
@@ -6,6 +6,7 @@ from bs4 import BeautifulSoup
import csv
import json
import time
+from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -27,11 +28,11 @@ from nba_data.models import PlayerPlayoffTotalsData
# Change LAC to SDC for 1984 and prior.
-teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
+teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
season = input('What season? ')
-for team in teams:
+for team in teams_data:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make)
diff --git a/nba_data/nba_scraper_totals.py b/nba_data/nba_scraper_totals.py
index 600e30a..c81300d 100644
--- a/nba_data/nba_scraper_totals.py
+++ b/nba_data/nba_scraper_totals.py
@@ -6,6 +6,7 @@ from bs4 import BeautifulSoup
import csv
import json
import time
+from data import teams_data
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -26,14 +27,14 @@ from nba_data.models import PlayerTotalsData
# Change MEM to VAN for 2001 and prior.
# Change LAC to SDC for 1984 and prior.
-teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'OKC', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
+teams = ['HOU' ,'PHI', 'BOS', 'NYK', 'NJN', 'TOR', 'MEM', 'NOH', 'DAL', 'SAS', 'DEN', 'MIN', 'SEA', 'UTA', 'POR', 'MIL', 'CLE', 'CHI', 'IND', 'DET', 'SAC', 'PHO', 'GSW', 'LAC', 'LAL', 'MIA', 'ATL', 'WAS', 'ORL', 'CHA']
# team = input('What team? ')
# OMIT above. Will now only ask for season and iterate thru teams list.
season = input('What season? ')
-for team in teams:
+for team in teams_data:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make)