better doc, reloader
This commit is contained in:
parent
d63eb48867
commit
e287e70f56
2 changed files with 23 additions and 34 deletions
37
README.md
37
README.md
|
@ -6,38 +6,35 @@ At the moment, it relies on some details that are specific of our radio (like
|
|||
the directory/format of the continous recording).
|
||||
|
||||
|
||||
|
||||
Implementation details
|
||||
======================
|
||||
|
||||
It is based on bottle, to get a minimal framework. Rest APIs are offered
|
||||
It is based on bottle, to get a minimal framework. Simple APIs are offered
|
||||
through it, and the static site uses them.
|
||||
|
||||
Here are some examples of APIs usage
|
||||
|
||||
Create
|
||||
--------
|
||||
|
||||
JSON = {
|
||||
'starttime-rec-1385231288390': '2013/11/23 19:32:49',
|
||||
'endtime-rec-1385231288390': '2013/11/23 19:32:49',
|
||||
'recid': 'rec-1385231288390',
|
||||
'name-rec-1385231288390': 'adasd',
|
||||
'op': 'new'
|
||||
}
|
||||
starttime-rec-1385231288390: 2013/11/23 19:32:49
|
||||
endtime-rec-1385231288390: 2013/11/23 19:32:49
|
||||
recid: rec-1385231288390
|
||||
name-rec-1385231288390: adasd
|
||||
op: new
|
||||
|
||||
Update
|
||||
-------
|
||||
|
||||
JSON = {
|
||||
'starttime-rec-1385231288390': '2013/11/23 19:32:49',
|
||||
'endtime-rec-1385231288390': '2013/11/23 19:32:49',
|
||||
'recid': 'rec-1385231288390', ### VALID REC ID
|
||||
'name-rec-1385231288390': 'adasd',
|
||||
'op': 'update'
|
||||
}
|
||||
starttime-rec-1385231288390: 2013/11/23 19:32:49
|
||||
endtime-rec-1385231288390: 2013/11/23 19:32:49
|
||||
recid: rec-1385231288390
|
||||
name-rec-1385231288390: adasd
|
||||
op: update
|
||||
|
||||
|
||||
Delete
|
||||
------
|
||||
JSON = {
|
||||
'recid': 'rec-1385231288390', ### VALID REC ID
|
||||
'op': 'delete'
|
||||
}
|
||||
|
||||
recid: rec-1385231288390
|
||||
op: delete
|
||||
|
|
|
@ -6,17 +6,12 @@ from bottle import Bottle, request, static_file, redirect
|
|||
from techrec import Rec, RecDB
|
||||
|
||||
class RecServer:
|
||||
def __init__(self,host="127.0.0.1", port=8000):
|
||||
self._host = host
|
||||
self._port = port
|
||||
|
||||
def __init__(self):
|
||||
self._app = Bottle()
|
||||
self._route()
|
||||
|
||||
self.db = RecDB()
|
||||
|
||||
def start(self):
|
||||
self._app.run(host=self._host, port=self._port, debug=True)
|
||||
|
||||
def _route(self):
|
||||
### This is the API part of the app
|
||||
|
@ -177,9 +172,6 @@ class RecServer:
|
|||
<h2>/update </h2>\
|
||||
<h3>Not implemented.</h3>"
|
||||
|
||||
"""
|
||||
TESTs
|
||||
"""
|
||||
if __name__ == "__main__":
|
||||
c = RecServer(host="localhost")
|
||||
c.start()
|
||||
c = RecServer()
|
||||
c._app.run(host="localhost", port="8000", debug=True, reloader=True)
|
||||
|
|
Loading…
Reference in a new issue