4 Commits
Author SHA1 Message Date
nprasad2077 5eaa50f4e7 central teams list 2023-09-20 02:33:13 -05:00
nprasad2077 4b1d07353d 2009 done 2023-09-20 01:08:57 -05:00
nprasad2077 0701ef19d2 usage and readme 2023-09-20 00:00:01 -05:00
nprasad2077 3558b1c154 script update 2023-09-19 19:15:12 -05:00
8 changed files with 449 additions and 251 deletions

No files matched your search

+424 -233
View File
@@ -1,281 +1,472 @@
# NBA Stats API 2.0
## 🔎 View the Interactive API Documentation
**[Interactive Swagger Documentation](https://api.server.nbaapi.com/swagger/index.html)** - Complete API reference with live testing capabilities
# NBA Stats API 0.1 Beta
## Introduction
This documentation provides comprehensive information for using the NBA Stats API. The API offers access to NBA season and playoff statistics, including player totals, advanced metrics, and historical data. All statistics are cross-referenced with [basketball-reference.com](https://www.basketball-reference.com/) and [NBA.com](https://www.nba.com/stats).
# NBA Player Statistics API
This API provides endpoints to query NBA player statistics, including both "Totals" data and "Advanced" statistical data. Each endpoint supports filtering, sorting, and pagination options to help you retrieve exactly the data you need.
## Base URL
All API endpoints are served from:
```
https://api.server.nbaapi.com/
```
## Authentication
No authentication is currently required for these endpoints.
## Available Endpoints
- **Player Advanced Stats** (`/api/playeradvancedstats`)
Provides advanced player metrics including Player Efficiency Rating (PER), True Shooting Percentage (TS%), Usage Percentage, Win Shares, VORP, and other advanced analytics.
- **Player Totals** (`/api/playertotals`)
Provides season-based totals such as points, assists, rebounds, games played, shooting percentages, and more traditional statistics.
This documentation provides the necessary information to use the NBA Stats API. These APIs provide access to NBA season and playoff totals, advanced statistics, shot chart data, and more.
---
## Common Query Parameters
Both endpoints support the following query parameters:
### Filtering Parameters
- **season** *(integer, optional)*: Filter by a specific season (e.g., `2025`)
- **team** *(string, optional)*: Filter by team abbreviation (e.g., `MIL`, `LAL`)
- **playerId** *(string, optional)*: Filter by player's unique ID (e.g., `greenaj01`)
- **isPlayoff** *(boolean, optional)*: Filter for playoff statistics (`true`) or regular season (`false`)
### Pagination Parameters
- **page** *(integer, optional)*: Page number to retrieve (default: `1`)
- **pageSize** *(integer, optional)*: Number of records per page (default: `20`)
### Sorting Parameters
- **sortBy** *(string, optional)*: Field name to sort results by (see endpoint-specific options below)
- **ascending** *(boolean, optional)*: Sort order - `true` for ascending, `false` for descending (default: `false`)
# [View API Documentation](https://documenter.getpostman.com/view/24232555/2s93shzpR3)
---
## Player Advanced Stats Endpoint
### Base URL
**GET** `/api/playeradvancedstats`
All URLs referenced in this documentation use the following base URL:
Retrieve advanced player statistics with comprehensive filtering and sorting options.
> <https://nba-stats-db.herokuapp.com/>
### Sorting Options for Advanced Stats
### Endpoints
The `sortBy` parameter accepts the following values:
- `games` - Games played
- `minutes_played` - Total minutes played
- `ts_percent` - True Shooting Percentage
- `total_rb_percent` - Total Rebound Percentage
- `usage_percent` - Usage Percentage
- `offensive_ws` - Offensive Win Shares
- `defensive_ws` - Defensive Win Shares
- `win_shares` - Total Win Shares (default)
- `win_shares_per` - Win Shares per 48 minutes
- `offensive_box` - Offensive Box Plus/Minus
- `defensive_box` - Defensive Box Plus/Minus
- `box` - Total Box Plus/Minus
- `vorp` - Value Over Replacement Player
- `season` - Season year
Top 20 Scorers by Season
Method: `Get`
### Example Request
> <https://nba-stats-db.herokuapp.com/api/playerdata/topscorers/total/season/2023/>
Success Response:
`Code: 200`
Content:
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playeradvancedstats?page=1&pageSize=20&sortBy=win_shares&ascending=false&season=2025&team=MIL' \
-H 'accept: application/json'
```
### Response Format
```json
{
"data": [
{
"id": 12345,
"playerName": "Giannis Antetokounmpo",
"position": "PF",
"age": 30,
"games": 65,
"minutesPlayed": 2205,
"per": 31.2,
"tsPercent": 0.614,
"threePAR": 0.156,
"ftr": 0.345,
"offensiveRBPercent": 11.2,
"defensiveRBPercent": 34.5,
"totalRBPercent": 22.8,
"assistPercent": 40.1,
"stealPercent": 1.8,
"blockPercent": 3.2,
"turnoverPercent": 16.7,
"usagePercent": 36.8,
"offensiveWS": 12.3,
"defensiveWS": 4.7,
"winShares": 17.0,
"winSharesPer": 0.370,
"offensiveBox": 8.9,
"defensiveBox": 2.1,
"box": 11.0,
"vorp": 9.2,
"team": "MIL",
"season": 2025,
"playerId": "antetgi01",
"isPlayoff": false
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 450,
"pages": 23
}
}
"count": 20,
"next": null,
"previous": null,
"results": [
{
"id": 40,
"player_name": "Jayson Tatum",
"age": 24,
"games": 74,
"games_started": 74,
"minutes_played": 2732,
"field_goals": 727,
"field_attempts": 1559,
"field_percent": "0.466",
"three_fg": 240,
"three_attempts": 686,
"three_percent": "0.350",
"two_fg": 487,
"two_attempts": 873,
"two_percent": "0.558",
"effect_fg_percent": "0.543",
"ft": 531,
"fta": 622,
"ft_percent": "0.854",
"ORB": 78,
"DRB": 571,
"TRB": 649,
"AST": 342,
"STL": 78,
"BLK": 51,
"TOV": 213,
"PF": 160,
"PTS": 2225,
"team": "BOS",
"season": 2023
},
{
"id": 20,
"player_name": "Joel Embiid",
"age": 28,
"games": 66,
"games_started": 66,
"minutes_played": 2284,
"field_goals": 728,
"field_attempts": 1328,
"field_percent": "0.548",
"three_fg": 66,
"three_attempts": 200,
"three_percent": "0.330",
"two_fg": 662,
"two_attempts": 1128,
"two_percent": "0.587",
"effect_fg_percent": "0.573",
"ft": 661,
"fta": 771,
"ft_percent": "0.857",
"ORB": 113,
"DRB": 557,
"TRB": 670,
"AST": 274,
"STL": 66,
"BLK": 112,
"TOV": 226,
"PF": 205,
"PTS": 2183,
"team": "PHI",
"season": 2023
},
...
]
}
```
---
Top 20 Scorers in Playoffs
Method: `Get`
## Player Totals Endpoint
> <https://nba-stats-db.herokuapp.com/api/playerdata/topscorers/playoffs/2022/>
**GET** `/api/playertotals`
Success Response:
Retrieve traditional player statistics including points, assists, rebounds, and shooting data.
`Code: 200`
### Sorting Options for Player Totals
Content:
The `sortBy` parameter accepts the following values:
- `games` - Games played
- `minutes_pg` - Minutes per game
- `three_fg` - Three-point field goals made
- `three_attempts` - Three-point field goal attempts
- `two_fg` - Two-point field goals made
- `effect_fg_percent` - Effective Field Goal Percentage
- `ft` - Free throws made
- `total_rb` - Total rebounds
- `assists` - Assists
- `steals` - Steals
- `blocks` - Blocks
- `points` - Points scored
- `season` - Season year
### Example Request
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playertotals?page=1&pageSize=20&sortBy=points&ascending=false&season=2025' \
-H 'accept: application/json'
```
### Response Format
```json
{
"data": [
{
"id": 67890,
"playerName": "Luka Doncic",
"position": "PG",
"age": 26,
"games": 70,
"gamesStarted": 70,
"minutesPg": 36.2,
"fieldGoals": 11.2,
"fieldAttempts": 23.1,
"fieldPercent": 0.485,
"threeFg": 4.1,
"threeAttempts": 11.3,
"threePercent": 0.363,
"twoFg": 7.1,
"twoAttempts": 11.8,
"twoPercent": 0.602,
"effectFgPercent": 0.574,
"ft": 7.8,
"ftAttempts": 9.2,
"ftPercent": 0.848,
"offensiveRb": 1.8,
"defensiveRb": 7.4,
"totalRb": 9.2,
"assists": 8.9,
"steals": 1.4,
"blocks": 0.5,
"turnovers": 4.1,
"personalFouls": 2.8,
"points": 34.3,
"team": "DAL",
"season": 2025,
"playerId": "doncilu01",
"isPlayoff": false
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 500,
"pages": 25
}
}
"count": 20,
"next": null,
"previous": null,
"results": [
{
"id": 16,
"player_name": "Jayson Tatum",
"age": 23,
"games": 24,
"games_started": 24,
"minutes_played": 983,
"field_goals": 201,
"field_attempts": 472,
"field_percent": "0.426",
"three_fg": 77,
"three_attempts": 196,
"three_percent": "0.393",
"two_fg": 124,
"two_attempts": 276,
"two_percent": "0.449",
"effect_fg_percent": "0.507",
"ft": 136,
"fta": 170,
"ft_percent": "0.800",
"ORB": 24,
"DRB": 137,
"TRB": 161,
"AST": 148,
"STL": 29,
"BLK": 21,
"TOV": 100,
"PF": 72,
"PTS": 615,
"team": "BOS",
"season": 2022
},
{
"id": 178,
"player_name": "Stephen Curry",
"age": 33,
"games": 22,
"games_started": 18,
"minutes_played": 764,
"field_goals": 202,
"field_attempts": 440,
"field_percent": "0.459",
"three_fg": 91,
"three_attempts": 229,
"three_percent": "0.397",
"two_fg": 111,
"two_attempts": 211,
"two_percent": "0.526",
"effect_fg_percent": "0.563",
"ft": 107,
"fta": 129,
"ft_percent": "0.829",
"ORB": 11,
"DRB": 104,
"TRB": 115,
"AST": 129,
"STL": 29,
"BLK": 8,
"TOV": 57,
"PF": 59,
"PTS": 602,
"team": "GSW",
"season": 2022
},
...
]
}
```
---
Top 20 Assists by Season
Method: `Get`
## Response Codes
> <https://nba-stats-db.herokuapp.com/api/top_assists/totals/2023/>
- **200 OK**: Request successful; returns requested data
- **400 Bad Request**: Invalid query parameters
- **404 Not Found**: No matching records found
- **500 Internal Server Error**: Server encountered an error
Success Response:
---
`Code: 200`
## Usage Examples
Content:
### Get Top Win Shares Leaders (Advanced Stats)
```
{
"count": 20,
"next": null,
"previous": null,
"results": [
{
"id": 529,
"player_name": "Trae Young",
"age": 24,
"games": 73,
"games_started": 73,
"minutes_played": 2541,
"field_goals": 597,
"field_attempts": 1390,
"field_percent": "0.429",
"three_fg": 154,
"three_attempts": 460,
"three_percent": "0.335",
"two_fg": 443,
"two_attempts": 930,
"two_percent": "0.476",
"effect_fg_percent": "0.485",
"ft": 566,
"fta": 639,
"ft_percent": "0.886",
"ORB": 56,
"DRB": 161,
"TRB": 217,
"AST": 741,
"STL": 80,
"BLK": 9,
"TOV": 300,
"PF": 104,
"PTS": 1914,
"team": "ATL",
"season": 2023
},
{
"id": 203,
"player_name": "Nikola Jokić",
"age": 27,
"games": 69,
"games_started": 69,
"minutes_played": 2323,
"field_goals": 646,
"field_attempts": 1022,
"field_percent": "0.632",
"three_fg": 57,
"three_attempts": 149,
"three_percent": "0.383",
"two_fg": 589,
"two_attempts": 873,
"two_percent": "0.675",
"effect_fg_percent": "0.660",
"ft": 341,
"fta": 415,
"ft_percent": "0.822",
"ORB": 167,
"DRB": 650,
"TRB": 817,
"AST": 678,
"STL": 87,
"BLK": 47,
"TOV": 247,
"PF": 174,
"PTS": 1690,
"team": "DEN",
"season": 2023
},
...
]
}
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playeradvancedstats?page=1&pageSize=10&sortBy=win_shares&ascending=false&season=2025' \
-H 'accept: application/json'
```
### Get Leading Scorers (Player Totals)
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,
"next": null,
"previous": null,
"results": [
{
"id": 16,
"player_name": "Jayson Tatum",
"age": 23,
"games": 24,
"games_started": 24,
"minutes_played": 983,
"field_goals": 201,
"field_attempts": 472,
"field_percent": "0.426",
"three_fg": 77,
"three_attempts": 196,
"three_percent": "0.393",
"two_fg": 124,
"two_attempts": 276,
"two_percent": "0.449",
"effect_fg_percent": "0.507",
"ft": 136,
"fta": 170,
"ft_percent": "0.800",
"ORB": 24,
"DRB": 137,
"TRB": 161,
"AST": 148,
"STL": 29,
"BLK": 21,
"TOV": 100,
"PF": 72,
"PTS": 615,
"team": "BOS",
"season": 2022
},
{
"id": 179,
"player_name": "Draymond Green",
"age": 31,
"games": 22,
"games_started": 22,
"minutes_played": 703,
"field_goals": 69,
"field_attempts": 144,
"field_percent": "0.479",
"three_fg": 8,
"three_attempts": 39,
"three_percent": "0.205",
"two_fg": 61,
"two_attempts": 105,
"two_percent": "0.581",
"effect_fg_percent": "0.507",
"ft": 30,
"fta": 47,
"ft_percent": "0.638",
"ORB": 26,
"DRB": 133,
"TRB": 159,
"AST": 138,
"STL": 25,
"BLK": 22,
"TOV": 59,
"PF": 87,
"PTS": 176,
"team": "GSW",
"season": 2022
},
...
]
}
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playertotals?page=1&pageSize=10&sortBy=points&ascending=false&season=2025' \
-H 'accept: application/json'
```
### Get Boston Celtics Players Advanced Stats
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,
"next": null,
"previous": null,
"results": [
{
"id": 405,
"player_name": "Domantas Sabonis",
"age": 26,
"games": 79,
"games_started": 79,
"minutes_played": 2736,
"field_goals": 577,
"field_attempts": 938,
"field_percent": "0.615",
"three_fg": 31,
"three_attempts": 83,
"three_percent": "0.373",
"two_fg": 546,
"two_attempts": 855,
"two_percent": "0.639",
"effect_fg_percent": "0.632",
"ft": 325,
"fta": 438,
"ft_percent": "0.742",
"ORB": 251,
"DRB": 722,
"TRB": 973,
"AST": 573,
"STL": 65,
"BLK": 39,
"TOV": 230,
"PF": 279,
"PTS": 1510,
"team": "SAC",
"season": 2023
},
{
"id": 346,
"player_name": "Nikola Vučević",
"age": 32,
"games": 82,
"games_started": 82,
"minutes_played": 2746,
"field_goals": 597,
"field_attempts": 1148,
"field_percent": "0.520",
"three_fg": 121,
"three_attempts": 347,
"three_percent": "0.349",
"two_fg": 476,
"two_attempts": 801,
"two_percent": "0.594",
"effect_fg_percent": "0.573",
"ft": 132,
"fta": 158,
"ft_percent": "0.835",
"ORB": 159,
"DRB": 744,
"TRB": 903,
"AST": 265,
"STL": 60,
"BLK": 57,
"TOV": 139,
"PF": 179,
"PTS": 1447,
"team": "CHI",
"season": 2023
},
...
]
}
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playeradvancedstats?team=BOS&season=2025&page=1&pageSize=20&sortBy=vorp&ascending=false' \
-H 'accept: application/json'
```
### Get Playoff Statistics
## Plan
```bash
curl -X GET \
'https://api.server.nbaapi.com/api/playertotals?isPlayoff=true&season=2024&sortBy=points&ascending=false' \
-H 'accept: application/json'
```
1. Data collection - Selenium - live data from dyanic websites. - Beautiful soap/scrapy - historical static data. - Live data - websocket connections or periodic updates.
&nbsp;
---
2. Backend API - Django (Python): A more comprehensive framework that includes an ORM and admin panel out-of-the-box. - Django REST Framework
&nbsp;
## Additional Resources
3. Backend DB
-Initially SQL lite, but it quickly met its limitations when trying to scrape data for 30 teams at once. It could not handle all the simulataneous connections.
- **Interactive Documentation**: [https://api.server.nbaapi.com/swagger/index.html](https://api.server.nbaapi.com/swagger/index.html)
- **Postman Collection**: Use the "Run in Postman" button above
- **Data Sources**: Statistics cross-referenced with Basketball Reference and NBA.com
- PostgreSQL is the new DB.
---
4. Frontend - React/Redux - D3.js - Chart.js - Highcharts - Websockets or Server-Sent Events
&nbsp;
## Contact & Support
If you encounter any issues or have questions about the API, please open an issue in the repository or contact the development team. 🏀🚀
---
**Note**: This API is currently in public beta. Features and endpoints may be updated based on user feedback and requirements.
5. Deployment
+5
View File
@@ -0,0 +1,5 @@
# Activate Python Shell
```
source venv/bin/activate
```
+1
View File
@@ -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']
+4 -2
View File
@@ -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,10 +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)
+4 -5
View File
@@ -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__))))
@@ -29,13 +30,11 @@ 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:
teams2 = 'PHI'
for team in teams2:
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
response = requests.get(url_make)
+3 -5
View File
@@ -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,14 +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']
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']
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)
+5 -4
View File
@@ -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)
+3 -2
View File
@@ -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)