Example #1
0
prefix = "/api/v1"
api.add_resource(SearchUsuario, prefix + "/pesquisa")

api.add_resource(SearchSala, prefix + "/pesquisalas")

api.add_resource(AdminResource, prefix + "/admins/<int:id>")
api.add_resource(AdminListResource, prefix + "/admins")

api.add_resource(UsuarioResource, prefix + "/usuarios/<int:id>")
api.add_resource(UsuarioListResource, prefix + "/usuarios")

api.add_resource(SalaResource, prefix + "/salas/<int:id>")
api.add_resource(SalaListResource, prefix + "/salas")
api.add_resource(SalaHorarioResource, prefix + "/salas/horarios/<int:id>")

api.add_resource(HorarioResource, prefix + "/horarios/<int:id>")
api.add_resource(HorarioListResource, prefix + "/horarios")

api.add_resource(JSONResource, prefix + "/json/<string:tipo>")

api.add_resource(RaspRfidResource, prefix + "/rasp/rfid")
api.add_resource(RaspHorarioResource, prefix + "/rasp/horario")
api.add_resource(RaspCheckEventoResource, prefix + "/rasp/checkevento")
api.add_resource(RaspEventoResource, prefix + "/rasp/evento")

if __name__ == "__main__":
    app.run(host=app.config["HOST"],
            port=app.config["PORT"],
            debug=app.config["DEBUG"])
Example #2
0
from setup import app, db
from rest.rest_departments import rest_departments_blueprint
from views.view_departments import view_departments_blueprint
from views.view_employees import view_employees_blueprint
from rest.rest_employees import rest_employees_blueprint
from flask import render_template, request, jsonify
from models.models import Department, Employee
db.create_all()

app.register_blueprint(rest_departments_blueprint, url_prefix='/rest/departments')
app.register_blueprint(rest_employees_blueprint, url_prefix='/rest/employees')
app.register_blueprint(view_departments_blueprint, url_prefix='/view/departments')
app.register_blueprint(view_employees_blueprint, url_prefix='/view/employees')


@app.route('/')
def index():
    data = request.get_json()
    print(data)
    return render_template('index.html')


if __name__ == '__main__':
    app.run(debug=True)
Example #3
0
from setup import app, PORT

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=PORT, debug=True)
Example #4
0
        if proposal.organizer in output:
            output[proposal.organizer].append(proposal.description)
        else:
            output[proposal.organizer] = [proposal.description]
    return jsonify(output)


@app.route('/admin/event/')
def getEventByOrgainzer():
    output = {}
    organizers = db.session.query(Organizer)
    for organizer in organizers:
        events = organizer.events
        output[organizer.id] = [event.speaker for event in events]
    return jsonify(output)


@app.route('/admin/feedback/')
def getFeedback():
    output = {}
    for result in db.session.query(Feedback.email).distinct():
        email = tuple(result)[0]
        feedbacks = db.session.query(Feedback).filter_by(email=email)
        output[email] = [feedback.content for feedback in feedbacks]
    return jsonify(output)


if __name__ == '__main__':
    app.debug = True
    app.run(host='0.0.0.0', port=5050)
Example #5
0
    for patient in patient_list:
        name = patient["firstname"] + " " + patient["lastname"]
        patients.append(name)
    return jsonify(patients)


@app.route('/autocompletebyhealthcard', methods=['GET'])
def autocompletebyhealthcard():
    search = request.args.get('q')
    query = 'SELECT * FROM ' + _PATIENTS_TABLE + ' WHERE CAST(healthcardno AS TEXT) LIKE ?'
    args = ('%' + search + '%')
    patient_list = fdb.query_db_get_all(query, (args, ))
    patients = []
    for patient in patient_list:
        name = patient["firstname"] + " " + patient["lastname"]
        patients.append(name)
    return jsonify(patients)


@app.route('/searchbyname', methods=['GET'])
def searchbyname():
    search = request.args.get('q')
    query = 'SELECT * FROM ' + _PATIENTS_TABLE + ' WHERE name=?'
    args = (search)
    patient = fdb.query_db_get_one(query, (args, ))
    return jsonify(patient)


if __name__ == '__main__':
    app.run(port=_PORT, host=_HOST)
Example #6
0
from flask_restful import Api
from setup import app
from rest.resources import *

api = Api(app)

api.add_resource(Dept, '/departments/<name>')
api.add_resource(DeptList, '/departments/')
api.add_resource(Emp, '/employees/<id>')
api.add_resource(EmpList, '/employees/')
api.add_resource(Heads, '/employees/heads')

if __name__ == '__main__':
    app.run()
#!/usr/bin/env python

from setup import app
from routes import *

if __name__ == '__main__':
    app.run(debug=True, port=4999)
Example #8
0
        self.log('User message: {0}'.format(msg))
        self.emit_to_room(self.room, 'msg_to_room',
                          self.session['nickname'], msg)
        return True

    def on_user_image(self, url):
        self.emit_to_room(self.room, 'user_image',
                          self.session['nickname'], url)
        return True


@app.route('/socket.io/<path:remaining>')
def socketio(remaining):
    try:
        socketio_manage(request.environ, {'/chat': ChatNamespace}, request)
    except:
        app.logger.error("Exception while handling socketio connection",
                         exc_info=True)
    return Response()

'''
Start development web server
'''
if __name__ == '__main__':
    create_app()
    init_db()
    ap = SharedDataMiddleware(app, {'/': os.path.join(os.path.dirname(__file__), 'static')})
    SocketIOServer(('0.0.0.0', 5000), ap,
                   namespace="socket.io", policy_server=False).serve_forever()
    app.run(debug=True)
Example #9
0
File: run.py Project: ohad24/erpy
from setup import app
from views import v_main, v_help_desk
import os

if __name__ == '__main__':
    app.logger.setLevel('DEBUG')
    app.testing = True
    app.env = 'development'
    app.run(
        host='0.0.0.0',
        debug=True,
        threaded=True,
        port=5103,
    )