- Import KBH

- Import BeerXML
- Import REST API
- Migration DB
- Set Default Screen after Start
- Cleanup
This commit is contained in:
Manuel83
2017-07-02 23:52:18 +02:00
parent c2aa5d8141
commit 291f09dcd1
30 changed files with 6519 additions and 120 deletions
+40 -2
View File
@@ -1,4 +1,5 @@
from flask import json
import yaml
from flask import json, url_for, Response
from flask_classy import FlaskView, route
from git import Repo, Git
@@ -101,7 +102,44 @@ class SystemView(FlaskView):
def dump(self):
return json.dumps(cbpi.cache)
@route('/endpoints', methods=['GET'])
def endpoints(self):
import urllib
output = []
vf = self.api.app.view_functions
for f in self.api.app.view_functions:
print f
endpoints = {}
re = {
"swagger": "2.0",
"host": "",
"info": {
"description":"",
"version": "",
"title": "CraftBeerPi"
},
"schemes": ["http"],
"paths": endpoints}
for rule in self.api.app.url_map.iter_rules():
r = rule
endpoints[rule.rule] = {}
if "HEAD" in r.methods: r.methods.remove("HEAD")
if "OPTIONS" in r.methods: r.methods.remove("OPTIONS")
for m in rule.methods:
endpoints[rule.rule][m] = dict(summary="", description="", consumes=["application/json"],produces=["application/json"])
with open("config/version.yaml", 'r') as stream:
y = yaml.load(stream)
pprint.pprint(y)
pprint.pprint(re)
return Response(yaml.dump(re), mimetype='text/yaml')
@cbpi.initalizer()
def init(cbpi):
print "INITIALIZE SYSTEM MODULE"
SystemView.api = cbpi
SystemView.register(cbpi.app, route_base='/api/system')