Giter Site home page Giter Site logo

py-rest-api's Introduction

A simple python, flask, mysql, restapi, swagger app

By no means this is a best practices example application. It does basic plumbing to get the tasks done. This application is a python restapi application which utlises the power of swagger to fetch data from open web service which return some json data. It can store data to local file and also to mysql database.

What it does

Refer swagger.yml for restapi calls

  1. Shows user information from py-rest-api in homepage http://localhost:9000

  2. http://localhost:9000/api/get-people-web reads py-rest-api and stores json data to a local file data.json

  3. http://localhost:9000/api/get-people-file reads from local data.json

  4. http://localhost:9000/api/save-people-db reads local data.json and inserts in mysql

Pre requisites

  1. Make Galera cluster up and running, Ref https://github.com/mumehta/eth-stack
  2. Create database by connecting to one of the endpoint, Ref eth-stack
  3. Create database person and exit
 create table person (id int(10) primary key not null auto_increment, fname varchar(255), lname varchar(255));
  1. Update the eth-stack's galara db (any node) endpoint to people.py file - pymysql.connect section

Build and run

  1. Make virtual env

python -m venv .venv

  1. pip install -r requirements.txt

  2. python app.py

  3. Open browser and make use of endpoint mentioned above

py-rest-api's People

Contributors

mumehta avatar

Watchers

 avatar

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.