생각보다 너무 다 바뀌어서 쉽지 않은..
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
import pymysql
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("headless")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
from flask import Flask, Response
import pymysql
import json
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/', methods=['GET'])
def home():
return Response(response_data, mimetype="application/json", status=200)
if __name__ == '__main__':
app.run(port=8000, debug=True)
pymysql 장점은 sql 문법 그대로 쓴다는 점인 것 같다
import pymysql
conn = pymysql.connect(host='127.0.0.1', user='root', password='0000', db="db")
cur = conn.cursor()
cur.execute("select * from [table])
result = cur.fetchall()
print(result)