From a2dfb5fdcfc541693f735cd433d33b140c152942 Mon Sep 17 00:00:00 2001 From: Rasmus Luha Date: Thu, 17 Mar 2022 19:23:03 +0200 Subject: another readme updata, removed __ini__'s --- README.md | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2a8c9a6..0c37073 100644 --- a/README.md +++ b/README.md @@ -3,37 +3,43 @@ This project has the functionality to fetch data about NBA and store it in csv f It also has an API to serve the data. API is at this [url](https://luhamus-nba-data.herokuapp.com/). -## How to use -### API +# How to use +## API From the api you can fetch data as follows: * For teams, the endpoint is "/teams" and you can fetch data as follows: ``` {api_url}/teams ``` -or just use [this](https://luhamus-nba-data.herokuapp.com/teams). + or just use [this](https://luhamus-nba-data.herokuapp.com/teams) link. -* For player information, the endpoint is "/players/{team_name} - - you can get the team name from fetching the teams data. - ''' - {api_url}/players/{team_name} - ''' +* For players information, you can search by the team. the endpoint is "/players/{team_name} + - you can get the team name from fetching the teams data from /teams. - Examples with Bulls, Celtics, Hawks: - * [https://luhamus-nba-data.herokuapp.com/teams/bulls](https://luhamus-nba-data.herokuapp.com/teams/bulls). - * [https://luhamus-nba-data.herokuapp.com/teams/celtics](https://luhamus-nba-data.herokuapp.com/teams/celtics). - * [https://luhamus-nba-data.herokuapp.com/teams/hawks](https://luhamus-nba-data.herokuapp.com/teams/hawks). - - NB: you shouldn't use the "full_name", like "Chicago Bulls". + * [https://luhamus-nba-data.herokuapp.com/players/bulls](https://luhamus-nba-data.herokuapp.com/players/bulls). + * [https://luhamus-nba-data.herokuapp.com/players/celtics](https://luhamus-nba-data.herokuapp.com/players/celtics). + * [https://luhamus-nba-data.herokuapp.com/players/hawks](https://luhamus-nba-data.herokuapp.com/players/hawks). + - NB: you shouldn't use the "fullName", like "Chicago Bulls". -### Fetching Data -Code for fetching data in in directory AllAboutData, where the -fetched data will also be stored. -To use the data fetching script, you should clone the repo and do following: +### API on localhost +To run the API locally, you should first clone the Repo and do the following: ```bash cd {cloned_repo_name} python -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -Then you should make a file +then you can run the API on localhost, at port 8000, as follows: +``` +uvicorn api.main:app --reload +``` +where reload option is for development. + + +## Fetching Data +Code for fetching data in in directory AllAboutData, where the +fetched data will also be stored. +To use the data fetching script, you should follow the same steps as +for running API locally. Then you should make a file ``` .env ``` -- cgit v1.2.3