{"id":21421419,"url":"https://github.com/percival33/nba-api","last_synced_at":"2025-07-05T08:33:20.017Z","repository":{"id":107185066,"uuid":"467264128","full_name":"Percival33/nba-api","owner":"Percival33","description":"Wrapper for API with NBA data ","archived":false,"fork":false,"pushed_at":"2022-07-14T16:29:10.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T20:14:02.374Z","etag":null,"topics":["api","nba-stats","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Percival33.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-07T21:24:39.000Z","updated_at":"2022-08-05T18:39:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"94d9dab3-727b-4bfe-b125-fa8457111253","html_url":"https://github.com/Percival33/nba-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Percival33/nba-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percival33%2Fnba-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percival33%2Fnba-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percival33%2Fnba-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percival33%2Fnba-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Percival33","download_url":"https://codeload.github.com/Percival33/nba-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Percival33%2Fnba-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263710469,"owners_count":23499701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","nba-stats","python3"],"created_at":"2024-11-22T20:34:11.170Z","updated_at":"2025-07-05T08:33:19.986Z","avatar_url":"https://github.com/Percival33.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nba-api\n\nThis was a recruitment task for Intern Python Developer.\n\nTask is to build a script/CLI that will process data from external [API](https://www.balldontlie.io/) about NBA related data and return desirable results.\n\n## Installation\n\nStart by cloning the repository:\n\n```\ngit clone https://github.com/Percival33/nba-api.git\n```\n\nUsage of `virtualenv` is recommended.\n\n\u003e While working on macOS replace `pip` with `pip3` and `python` with `python3`. To install pip3 on macOS install python3.\n\u003e\n\u003e ```\n\u003e brew install python3\n\u003e ```\n\u003e\n\u003e or follow instructions from this [page](https://www.delftstack.com/howto/python/python-install-pip3-mac/).\n\n- Start by installing `virtualenv`\n\n```\npip install virtualenv\n```\n\n- When installation is completed, go to project folder\n\n```\ncd nba-api\n```\n\n- Create virtual environment called `venv`\n\n```\npython -m virtualenv venv\n```\n\n- Then activate `venv` it\n\n```\nsource venv/bin/activate\n```\n\n- Install all python dependencies:\n\n```py\npip install -r requirements.txt\n```\n\n- **Now you are ready to use script**\n\n\u003e  - When you are done, deactivate `venv` using command:\n\u003e\n\u003e  ```\n\u003e  deactivate\n\u003e  ```\n\n## Usage\n\n### 0. To get help with arguments or its values\n\n- Example usage: (to get help with general usage)\n\n  ```py\n  $ python script.py -h\n  usage: script.py [-h] {grouped-teams,players-stats,teams-stats} ...\n\n  positional arguments:\n    {grouped-teams,players-stats,teams-stats}\n      grouped-teams       Get all teams grouped in divisions\n      players-stats       Get players with name (first or last) who is the tallest and is the heaviest\n      teams-stats         Get statistics for a given season and optionally store it\n\n  optional arguments:\n    -h, --help            show this help message and exit\n  ```\n\n- Example usage: (of specific help)\n\n  ```py\n  $ python script.py teams-stats --season 2018 -h\n  usage: script.py teams-stats [-h] --season SEASON [--output {csv,json,sqlite,stdout}]\n\n  optional arguments:\n    -h, --help            show this help message and exit\n    --season SEASON       Seasons are represented by the year they began. For example, 2018 represents season 2018-2019.\n    --output {csv,json,sqlite,stdout}\n                          Choose output format. stdout is default\n  ```\n\n- To get help with specific argument value use `-h` or `--help`\n\n  Example usage:\n\n  ```py\n  $ python script.py players-stats -h\n  usage: script.py players-stats [-h] --name NAME\n\n  optional arguments:\n    -h, --help   show this help message and exit\n    --name NAME  Provide first or last name of player to get their statistics\n  ```\n\n### 1. Getting all teams grouped by divisions\n\nExample input:\n\n```py\npython script.py grouped-teams\n```\n\nExample output:\n\n```\nSoutheast\n        Atlanta Hawks (ATL)\n        Charlotte Hornets (CHA)\n        Miami Heat (MIA)\n        Orlando Magic (ORL)\n        Washington Wizards (WAS)\nAtlantic\n        Boston Celtics (BOS)\n        Brooklyn Nets (BKN)\n        New York Knicks (NYK)\n        Philadelphia 76ers (PHI)\n        Toronto Raptors (TOR)\n\u003crest of the teams and divisions\u003e\n```\n\n### 2. Get players with a specific name who is the tallest and another one who weight the most (values in metric system)\n\n`--name` parameter is **required**. Provide first or last name.\n\nExample input:\n\n```py\npython script.py players-stats --name James\n```\n\nExample output:\n\n```\nThe tallest player: James Johnson 2.03 meters\nThe heaviest player: LeBron James 113 kilograms\n```\n\nor if there is no data provided:\n\n```\nThe tallest player: Not found\nThe heaviest player: Not found\n```\n\n### 3. Get statistics for a given season and optionally store it\n\n- `--season` parameter is **required**. Seasons are represented by the year they began. For example, 2018 represents season 2018-2019\n\n- `--output` parameter is optional. The default value is `stdout`. Otherwise, output.\\* file will be created.\n\n  Possible parameters:\n\n  - json\n  - csv\n  - sqlite\n  - stdout\n\nExample input:\n\n```py\npython script.py teams-stats --season 2018\n```\n\nExample output:\n\n```\nAtlanta Hawks (ATL)\n    won games as home team: 17\n    won games as visitor team: 12\n    lost games as home team: 24\n    lost games as visitor team: 29\nBoston Celtics (BOS)\n    won games as home team: 30\n    won games as visitor team: 24\n    lost games as home team: 15\n    lost games as visitor team: 22\nBrooklyn Nets (BKN)\n\u003crest of teams statistics\u003e\n```\n\n## TODO (in future)\n\n- [x] add specification section\n- [x] add examples of usage\n- [x] teams related data i.e. teams grouped into divisions\n- [x] specific player data\n- [x] season statistics\n- [x] storing options (json, csv, sqlite, stdout)\n- [x] add type hinting\n- [ ] add **tests**\n- [ ] add autocomplete/autosuggestion\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercival33%2Fnba-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpercival33%2Fnba-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpercival33%2Fnba-api/lists"}