This commit is contained in:
parent
a028b348c0
commit
ed67f78a55
|
|
@ -12,7 +12,7 @@ app = Flask(__name__)
|
||||||
api = Api(app, version='1', contact={"name":""}, license={"name":"Online Dienst Dokumentation"}, api_spec_url='/api/swagger')
|
api = Api(app, version='1', contact={"name":""}, license={"name":"Online Dienst Dokumentation"}, api_spec_url='/api/swagger')
|
||||||
|
|
||||||
|
|
||||||
api.add_resource(endpoints.PersonList,'/api/v1/person/<string:id>')
|
api.add_resource(endpoints.PersonList,'/api/v1/person/<string:id>', '/api/v1/person/')
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import json
|
||||||
from application.db import Session, Person, Fingerprint
|
from application.db import Session, Person, Fingerprint
|
||||||
|
|
||||||
class PersonList(Resource):
|
class PersonList(Resource):
|
||||||
def post(self, id):
|
def post(self, id = None):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
data = ""
|
data = ""
|
||||||
|
|
@ -15,7 +15,7 @@ class PersonList(Resource):
|
||||||
print("error: -", e)
|
print("error: -", e)
|
||||||
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
||||||
|
|
||||||
def get(self, id):
|
def get(self, id = None):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
session = Session()
|
session = Session()
|
||||||
|
|
@ -23,7 +23,6 @@ class PersonList(Resource):
|
||||||
person = Person(fname="hi", fingerprints=[fingerprint])
|
person = Person(fname="hi", fingerprints=[fingerprint])
|
||||||
session.add(fingerprint)
|
session.add(fingerprint)
|
||||||
session.add(person)
|
session.add(person)
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
data = list(session.query(Person).all())
|
data = list(session.query(Person).all())
|
||||||
|
|
@ -37,7 +36,7 @@ class PersonList(Resource):
|
||||||
print("error: -", e)
|
print("error: -", e)
|
||||||
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
||||||
|
|
||||||
def put(self, id):
|
def put(self, id = None):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
data = ""
|
data = ""
|
||||||
|
|
@ -46,7 +45,7 @@ class PersonList(Resource):
|
||||||
print("error: -", e)
|
print("error: -", e)
|
||||||
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
||||||
|
|
||||||
def delete(self, id):
|
def delete(self, id = None):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
data = ""
|
data = ""
|
||||||
|
|
|
||||||
2
run.py
2
run.py
|
|
@ -1,6 +1,6 @@
|
||||||
from application import app
|
from application import app
|
||||||
|
|
||||||
app.run(host="0.0.0.0",port='10024', debug=True)
|
app.run(host="localhost",port='10024', debug=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
BIN
test.sqlite
BIN
test.sqlite
Binary file not shown.
Loading…
Reference in New Issue