Giter VIP home page Giter VIP logo

flask-api-sdetautomation's Introduction

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

flask-api

  • sample project building an api using flask and python

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 database directory for more details

  • This project was written using VS Code

Installing Project Dependencies

This project uses venv for virtual environment management.

  • Create a virtual environment with:

    python3 -m venv venv

  • Installing Flask dependencies with: pip install flask[all]

Running the application

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

    flask run --debug or python app.py

Project Database

  • This project uses local sqlite for a repository

Swagger

Rest Api

Users API

TDD - Integration Tests

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

  • Tests connect to test.db for integration tests

Flask Project

Continuous Integration(CI)

  • A webhook can be setup with Travis CI for all Push and Pull requests

Questions/Contribute

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

Docker

  • This application uses Docker. Pease see Dockerfile for image setup. Steps to create a docker image and how to run the app in a container list below. (must have docker installed)

  • Create a Docker image: docker build -t flask-api-sdetautomation .

  • Run a Docker container: docker run -it p 5000:5000 flask-api-sdetautomation

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

  • View Docker images: docker images

  • View Docker container: docker ps

    • (This command can also be used to fine the container id for stopping or removing containers)
  • Stop Docker container: docker stop <the-container-id>

  • Remove a Docker container: docker rm <the-container-id>

  • Remove a Docker image: docker rmi <repository-name>:<tag>

Click here for more information regarding Docker

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

flask-api-sdetautomation's People

Contributors

johnnypham7496 avatar

Watchers

 avatar

flask-api-sdetautomation's Issues

Activity dashboard

DashList

๐Ÿ‘‹ This dashboard summarizes my activity on the repository, including available improvement opportunities.

Recommendations

Last analysis: Feb 13 | Next scheduled analysis: Feb 20

Open

โœ… Nice work, you're all caught up!

Available

โœ… Nothing yet, but I'm continuing to monitor your PRs.

Metrics

What would you like to see here? Let us know!

Resources

๐Ÿ“š Quick links
Pixee Docs | Codemodder by Pixee

๐Ÿงฐ Tools I work with
Sonar, CodeQL, Semgrep

๐Ÿš€ Pixee CLI
The power of my codemods in your local development environment. Learn more

๐Ÿ’ฌ Reach out
Feedback | Support


โค๏ธ Follow, share, and engage with Pixee: GitHub | LinkedIn | Slack

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.