mirror of
https://github.com/heyarne/berliner-winter.git
synced 2026-05-06 19:23:39 +02:00
Add API for location
This commit is contained in:
parent
c09a1d78a2
commit
13791c0599
2 changed files with 25 additions and 0 deletions
15
server.py
Normal file
15
server.py
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue