Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/getdata', methods =['GET', 'POST'])
- #@requires_auth
- def get_data():
- config = {
- 'user': 'user',
- 'password': 'password.',
- 'host': '127.0.0.1',
- 'database': 'database',
- 'raise_on_warnings': True,
- 'use_pure': False,
- }
- cnx = mysql.connector.connect(**config)
- cur = cnx.cursor()
- cur.execute("SELECT hash FROM hash_files")
- rows = cur.fetchall()
- response = [row['hash'] for row in rows]
- return jsonify(response)
- cnx.close()
Add Comment
Please, Sign In to add comment