A Pokeman based REST API written in Python using the Flask Restful framework.
You need to make sure your system has the following tools installed:
- Python 3.6.9 (tested on this version) or newer
- Python 3 Virtual Environments
- PIP 3 Package Manager
To verify/install on Debian Linux:
sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install python3-venv
Next duplicate the environment_variables.example
file and rename the new file as just environment_variables
, you don't need to modify the contents currently.
Finally, you can run the developmeny server by running the shell script ./run-development-server.sh
.
You can also run the unit tests by using ./runtests.sh
, this first runs a Flake8 linting test and then proceeds to run all the unit tests.
Change into this project directory and build the Docker container:
docker build -t faisal/pokedex .
Run the Docker container and expose port 5000, remember to include the required environment variables:
docker run -p 5000:5000 --env POKEAPI_URL="https://pokeapi.co/api/v2" --env FUNTRANSLATIONS_URL="https://api.funtranslations.com/translate" faisal/pokedex
- Use a more secure and advanced framework like Django REST.
- Add some kind of authentication such as OAuth2 (built into Django) or even front it with a seperate authentication layer, such as using Kong API.
- Would write seperate integration tests that are capable of hitting test API instances, so that the unit tests can actually hit the servers without having to rely solely on mocked responses.
- Use the Python logging module to add logging throughout the API.
- Would create a third parent abstract class called ApiWrapper that both the FunTranslationAPIWrapper and PokeAPIWrapper classes inherit from to remove duplication.
- Would not be developing on main / master branch.
- Add gunicorn log config file to ensure the logs are outputted to the container.