项目作者: motamed

项目描述 :
Sample Flask REST API
高级语言: Python
项目地址: git://github.com/motamed/flask-rest-sample.git
创建时间: 2019-01-30T14:39:17Z
项目社区:https://github.com/motamed/flask-rest-sample

开源协议:

下载


Flask REST Sample

This Repo Contains Simple REST API that gets Airport and Airline Details

Requirements

  • python 2.7+
  • flask
  • flask_restful

Installation

  1. $ pip install -r requirements.txt

Run

  1. $ python application.py
  2. * Serving Flask app "application" (lazy loading)
  3. * Environment: production
  4. WARNING: Do not use the development server in a production environment.
  5. Use a production WSGI server instead.
  6. * Debug mode: on
  7. * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  8. * Restarting with stat
  9. * Debugger is active!

Test

goto —> localhost:5000/

Alt text

Start Using

GET

Airports

  • localhost:5000/airport/{IATA_code}
  • localhost:5000/airportname/{IATA_code}
  • localhost:5000/airportlocation/{IATA_code}

Airlines

  • localhost:5000/airline/{IATA_code}
  • localhost:5000/airlinecode/{airline_ID}

POST

  • Soon … !!

Example

Airport

Alt text

Airline

Alt text

Reference

Airport and Airline data from https://openflights.org/data