Giter Site home page Giter Site logo

flask-rest-auto's Introduction

Car REST service

python flask-restful app to deliver info about cars with the following specs:

  • description
  • engine (cylindree)
  • make (mark)
  • year (annee)
  • owner (nom du proprietaire)
  • photo (photo de la voiture)

API supports GET,POST,PUT,DELETE, and PATCH

json structure for curl:

curl -X POST -v \
  -H "Content-Type: multipart/form-data" \
  -F "photoupload=@script_photo.jpg"  \
  -F 'json_str={"description":"speedy","engine":"pv300","make":"honda","year":"1990","owner":"Don d."}' \
  http://limitless-coast-3433.herokuapp.com/cars

###testing http server with curl There is a server running at http://limitless-coast-3433.herokuapp.com/ the rest endpoint is at http://limitless-coast-3433.herokuapp.com/cars

To test out the REST-api on the heroku server, use the scripts inside the heroku_curl_tests folder

   $ ./heroku_curl_tests/get-car.sh
   $ ./heroku_curl_tests/post-car.sh
   **see post results**
   $ ./heroku_curl_tests/get-car.sh

###accessing photo data The photo value is reachable by appending to the root site: so with an example item with json:

{"name": "john", "photo": "/static/images/default.jpg", "year": "1988", "description": "roadster", "make": "honda", "engine": "1300"}

The photo would be accessible via a static folder at:

http://limitless-coast-3433.herokuapp.com/static/images/default.jpg

Setting up to run locally

Clone, Install requirements into a virtualenv, then run:

  $ mkdir rest-auto && cd rest-auto
  $ git clone [email protected]:cclay/flask-rest-auto.git .
  $ virtualenv env
  $ source env/bin/activate
  $ pip install -r requirements.txt
  $ python app.py
  $ deactivate # Stop virtualenv when you are done

###python testing tests are located in the tests.py file

    $ python tests.py

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.