예제 #1
0
def _db_close(exc):
    if not db.is_closed():
        print("====Start====")
        print(db)
        print(db.close())
        print("=====End=====")
    return exc
예제 #2
0
def _db_close(exc):
    if not db.is_closed():
        print(db)
        print(db.close())
    return exc


# @app.after_request
# def add_headers(response):
#     response.headers.add('Content-Type', 'application/json')
#     response.headers.add('Access-Control-Allow-Origin', '*')
#     response.headers.add('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS')
#     response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
#     response.headers.add('Access-Control-Expose-Headers', 'Content-Type,Content-Length,Authorization,X-Pagination')
#     return response
예제 #3
0
def _db_close(exc):
    if not db.is_closed():
        print(db)
        print(db.close())
    return exc

# Twilio
# @app.route('/login', methods=['POST'])
# def login():
#     username = request.get_json(force=True).get('username')
#     if not username:
#         abort(401)

#     token = AccessToken(twilio_account_sid, twilio_api_key_sid,
#                         twilio_api_key_secret, identity=username)
#     token.add_grant(VideoGrant(room='My Room'))

#     return {'token': token.to_jwt().decode()}
예제 #4
0
def _db_close(exc):
    if not db.is_closed():
        print(db)
        print(db.close())
    return exc
예제 #5
0
def before_request():
    db.close()
    db.connect()
예제 #6
0
def _db_close(exc):
    if not db.is_closed():
        db.close()
    return exc
예제 #7
0
def after_request(response):
    db.close()
    return response