def _db_close(exc): if not db.is_closed(): print("====Start====") print(db) print(db.close()) print("=====End=====") return exc
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
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()}
def _db_close(exc): if not db.is_closed(): print(db) print(db.close()) return exc
def before_request(): db.close() db.connect()
def _db_close(exc): if not db.is_closed(): db.close() return exc
def after_request(response): db.close() return response