Flask Api

sample project building an api using flask
Alternatives To Flask Api
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Whoogle Search7,463
3 days ago21June 13, 202253mitPython
A self-hosted, ad-free, privacy-respecting metasearch engine
Blockchain7,237
5 months ago115mitC#
A simple Blockchain in Python
Proxypool4,411
3 months ago33mitPython
An Efficient ProxyPool with Getter, Tester and Server
Nginx Ui4,294
a month ago21mitPython
Nginx UI allows you to access and modify the nginx configurations files without cli.
App3,770
3 days ago118agpl-3.0Python
The SimpleLogin back-end
Kubernetes Workshop3,178
3 months ago8Python
⚙️ A Gentle introduction to Kubernetes with more than just the basics. 🌟 Give it a star if you like it.
Uwsgi Nginx Flask Docker2,836
a month ago31apache-2.0Python
Docker image with uWSGI and Nginx for Flask applications in Python running in a single container. Optionally with Alpine Linux.
Yacht2,663
9 days ago138mitVue
A web interface for managing docker containers with an emphasis on templating to provide 1 click deployments. Think of it like a decentralized app store for servers that anyone can make packages for.
Iptv M3u Maker2,110
10 months ago22mitHTML
IPTV 国内+国外 电视台直播源m3u文件, 收集&汇总&本地源脚本
Git Webhook1,339
6 years ago12mitPython
:octocat: 使用 Python Flask + SQLAchemy + Celery + Redis + React 开发的用于迅速搭建并使用 WebHook 进行自动化部署和运维,支持 Github / GitLab / Gogs / GitOsc。
Alternatives To Flask Api
Select To Compare


Alternative Project Comparisons
Readme
#             .___      __     _____          __                         __  .__               
#    ______ __| _/_____/  |_  /  _  \  __ ___/  |_  ____   _____ _____ _/  |_|__| ____   ____  
#   /  ___// __ |/ __ \   __\/  /_\  \|  |  \   __\/  _ \ /     \\__  \\   __\  |/  _ \ /    \ 
#   \___ \/ /_/ \  ___/|  | /    |    \  |  /|  | (  <_> )  Y Y  \/ __ \|  | |  (  <_> )   |  \
#  /____  >____ |\___  >__| \____|__  /____/ |__|  \____/|__|_|  (____  /__| |__|\____/|___|  /
#       \/     \/    \/             \/                         \/     \/                    \/ 

flask-api

sample project building an api using flask and python

Build Status

Build Status

Introduction

This project is made for anyone who is looking for an example of how to create a rest endpoint using Python and Flask.

This service calls a local sqlite database. Please see databases directory for more details.

This projet was written using PyCharm Community Edition.

Installing Project Dependencies

This project uses Pipenv for virtual environment management.

If you are on MacOS you can install the dependency using homebrew:

brew install pipenv

Next run the following command to install the dependencies on your local computer:

pipenv install

Running the application

After you have performed all the dependency installations from above, you can run the following command on your terminal to start this app.

From the root of this project enter the following terminal command:

pipenv run python app.py

Or you can also start the application using PyCharm.

Project Database

This project uses a local sqlite for a repository.

Swagger

This project contains a swagger ui.

For more information regarding swagger. Click here.

For more information regarding connexion. Click here.

To view this api's swagger ui, run this application, then navigate to [http://localhost:5000/ui/]

You can test out this api entirely from the swagger ui page.

This app is also deployed using heroku. To view deployed api swagger navigate to [https://sdet-flask-api.herokuapp.com/ui/]

Rest Api

Users Api

GET - getAll: users/v1

GET - getByUsername: users/v1/darth

PUT - updateUserEmail: users/v1/darth + include a json body with new email.

DELETE - deleteUsername: users/v1/darth

Users Api - deployed on heroku

GET - getAll: users/v1

GET - getByUsername: users/v1/darth

PUT - updateUserEmail: users/v1/darth + include a json body with new email.

DELETE - deleteUsername: users/v1/darth

Locations Api

GET - getAll: locations/v1

GET - getByState: locations/v1/ca

PUT - updateCapital: locations/v1/ca + include a json body with new capital.

DELETE - deleteLocation: locations/v1/ca

Locations Api - deployed on heroku

GET - getAll: locations/v1

GET - getByState: locations/v1/ca

PUT - updateCapital: locations/v1/ca + include a json body with new capital.

DELETE - deleteLocation: locations/v1/ca

TDD - Integration Tests

This api is fully tested with Unit Tests and Integration tests. Please see tests directory for examples.

Tests connect to test.db for integration tests.

Flask Project

This project is a Flask project. For more information click here

Docker

This application can be run in Docker. Please see Dockerfile for image setup. Steps to create an image & how to run the app in a container list below. (must have docker installed)

Create a docker image: docker build -t flask-api .

Run docker container: docker run -it -p 5000:5000 flask-api

*** Once app has started, view the swagger ui by navigating to [http://localhost:5000/ui/] ***

View docker images: docker images

View docker containers: docker ps -a

Remove docker images: docker rmi $(docker images -q)

Remove docker containers: docker rm $(docker ps -aq)

Click here for more information regarding docker

* Note: this flask app by default runs as a development server, not meant for production. Docker & gunicorn is used to productionize this app. This docker container runs as as a production WSGI server, with 4 workers via gunicorn. *

Continuous Integration(CI)

A web hook has been setup with Travis CI for all Push and Pull Requests.

A web hook has also been setup with Github Actions for all Push and Pull Requests.

Continuous Deployment(CD)

This app is setup to deploy via heroku after a successful CI.

To view deployed api swagger click here

Questions / Contact / Contribute

Feel free to fork this repo, add to it, and create a pull request if you like to contribute.

If you have any questions, you can contact me via email: [email protected]

Popular Flask Projects
Popular Docker Projects
Popular Frameworks Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Python
Docker
Dockerfile
Flask
Restful Api
Heroku
Location
Sqlite
Swagger
Sqlalchemy
Ci Cd
Pytest
Json Schema