Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. @app.route('/api/days', methods=['GET'])
  2. def get_all_days():
  3. db = pymysql.connect(host='xyz.com', user='userName',
  4. passwd='password', db='someDB')
  5. cursor = db.cursor()
  6. cursor.execute("SELECT date, start_hour, end_hour, is_free, note FROM Days WHERE user_token=%s" %
  7. str(request.args.get("user_token")))
  8. data = [dict((cursor.description[i][0], value) for i, value in enumerate(row)) for row in cursor.fetchall()]
  9. return jsonify(data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement