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
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
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