https://github.com/tadghw/psychic-winner
RESTful API built in Python and Flask with test coverage and HTML form support.
https://github.com/tadghw/psychic-winner
flask python rest-api sqlite3
Last synced: about 2 months ago
JSON representation
RESTful API built in Python and Flask with test coverage and HTML form support.
- Host: GitHub
- URL: https://github.com/tadghw/psychic-winner
- Owner: TadghW
- Created: 2023-01-21T14:58:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-02T15:57:55.000Z (over 3 years ago)
- Last Synced: 2025-01-25T19:07:44.905Z (over 1 year ago)
- Topics: flask, python, rest-api, sqlite3
- Language: Python
- Homepage:
- Size: 10.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Coding Challenge Submission | Tadgh Wagstaff
*Please notes see about this solution and instructions on how to run the software below*
### Notes:
1) I decided to use Python for this solution to compliment my Java-based REST API available [here](https://github.com/TadghW/pprRank).
2) I was informed that the Python team use Flask, so I decided to work with Flask for this solution
2) Although both teams use AWS I decided that using a remote db exceeded the scope of this assignment. Instead, I used a local database instance with SQLite 3, a combination suggested in the [Flask documentation](https://flask.palletsprojects.com/en/2.2.x/patterns/sqlite3/)
3) Because the documentation states that the solution should be considered a proof of concept I haven't done performance testing or implemented query caching. I also haven't containerised or hosted the application. You can find a containerised and hosted example of [this project](https://github.com/TadghW/pprRank) [here](https://headphones.science)
4) You can interface with the program directly by sending requests to the endpoints, or through a dashboard I made by visiting `localhost:5000` in your browser
### How to run:
_**Step 1 - Create virtual environment:**_
Create a new folder at the root of this directory named ``env``, and then create a new virtual environment within that folder using [venv](https://docs.python.org/3/library/venv.html#module-venv) with the command ``python -m venv ./env``
_**Step 2 - Enter virtual environment:**_
Using a terminal / CLI navigate to ``env/Scripts`` (Windows) or ``env/bin`` (MacOS, Linux, Unix-based OS) and run `./activate` to enter the virtual environment
_**Step 3 - Install requirements:**_
Navigate back to the root folder in the terminal and enter the command `pip install -r requirements.txt`
_**Step 4 - Launch API + Integration Testing:**_
While inside the virtual environment you can launch the API from the terminal with `python app.py`. Once the API is running, you can run the accompanying integration tests from the terminal with `pytest test_integration_tests.py` (so long as you're in the virtual environment)