Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/api/days', methods=['GET'])
- def get_all_days():
- db = pymysql.connect(host='xyz.com', user='userName',
- passwd='password', db='someDB')
- cursor = db.cursor()
- cursor.execute("SELECT date, start_hour, end_hour, is_free, note FROM Days WHERE user_token=%s" %
- str(request.args.get("user_token")))
- data = [dict((cursor.description[i][0], value) for i, value in enumerate(row)) for row in cursor.fetchall()]
- return jsonify(data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement