clean up catch error

This commit is contained in:
wcolmenares 2019-06-05 06:02:14 -04:00
parent d4d82ae1c3
commit 170c7727e4
1 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class ProtectedView(Resource):
assert(realm == config('REALM_ALLOWED'))
code = check_otp(user, realm, token)
assert(code == 200)
except KeyError or AssertionError:
except (KeyError, AssertionError) as e:
response = app.response_class(response=json.dumps({'Message': 'Invalid data'}),
status=400,
mimetype='application/json')
@ -63,4 +63,4 @@ api.add_resource(MainView, '/')
api.add_resource(ProtectedView, '/protected')
if __name__ == '__main__':
app.run()
app.run(host='::')