Add API for location

This commit is contained in:
Arne Schlüter 2015-02-07 17:19:22 +01:00
commit 13791c0599
2 changed files with 25 additions and 0 deletions

15
server.py Normal file
View file

@ -0,0 +1,15 @@
import bottle
from json import dumps
from models import *
@bottle.get('/locations/<article_id:int>')
def location(article_id):
return (Location
.select()
.where(Location.article == article_id)
.order_by(Location.confidence.desc(), Location.id.asc())
.dicts()
.get())
if __name__ == '__main__':
bottle.run(host='localhost', port=12345, reloader=True, debug=True)