Created
March 24, 2020 21:15
-
-
Save MinaGabriel/d13b464a10ce533a2c737c79598221ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from flask import Flask, jsonify, request | |
from keras.datasets import mnist | |
import MySQLdb | |
app = Flask(__name__) | |
@app.route("/", methods=["GET", "POST"]) | |
def hello(): | |
db = MySQLdb.connect(user='myhu', password='password', host='98.111.105.254', database='w3schools') | |
cursor = db.cursor() | |
query_string = "SELECT customerName FROM customers WHERE country = %s" | |
cursor.execute(query_string, (request.args.get("country"),)) | |
data = cursor.fetchall() | |
db.close() | |
return jsonify(data) | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment