This commit is contained in:
Askill 2020-03-16 00:31:07 +01:00
parent a028b348c0
commit ed67f78a55
4 changed files with 6 additions and 7 deletions

View File

@ -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.add_resource(endpoints.PersonList,'/api/v1/person/<string:id>')
api.add_resource(endpoints.PersonList,'/api/v1/person/<string:id>', '/api/v1/person/')
@app.route("/")
def index():

View File

@ -6,7 +6,7 @@ import json
from application.db import Session, Person, Fingerprint
class PersonList(Resource):
def post(self, id):
def post(self, id = None):
""" """
try:
data = ""
@ -15,7 +15,7 @@ class PersonList(Resource):
print("error: -", e)
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
def get(self, id):
def get(self, id = None):
""" """
try:
session = Session()
@ -23,7 +23,6 @@ class PersonList(Resource):
person = Person(fname="hi", fingerprints=[fingerprint])
session.add(fingerprint)
session.add(person)
session.commit()
data = list(session.query(Person).all())
@ -37,7 +36,7 @@ class PersonList(Resource):
print("error: -", e)
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
def put(self, id):
def put(self, id = None):
""" """
try:
data = ""
@ -46,7 +45,7 @@ class PersonList(Resource):
print("error: -", e)
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
def delete(self, id):
def delete(self, id = None):
""" """
try:
data = ""

2
run.py
View File

@ -1,6 +1,6 @@
from application import app
app.run(host="0.0.0.0",port='10024', debug=True)
app.run(host="localhost",port='10024', debug=True)

Binary file not shown.