【发布时间】:2021-12-25 16:29:50
【问题描述】:
我正在尝试将来自 messenger 的所有消息及其发件人存储在 24/7 运行的数据库中。 下面的代码缩写为ver。整个代码只获取存储在数据库中的发件人以将它们与新的发件人进行比较。
我的问题是:
当我使用本地 chrome 驱动程序执行以下代码时
driver = webdriver.Chrome('/Users/USER/Projects/seleniumBeta/chromedriver 15-24-35-680', chrome_options=chrome_options)
程序成功地从数据库中获取数据。 但是当我用
在heroku上运行以下代码时heroku 运行 python3 app.py
from sqlalchemy import create_engine, text
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
import os
...
database = create_engine(DB_URL, encoding='utf-8', max_overflow=0)
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options)
globalURL = 'https://www.messenger.com/t/101210925710184'
driver.get(globalURL)
(... LOGIN CODES)
def repeater():
senders = [sender['name'] for sender in database.execute(text("SELECT * FROM senders")).fetchall()]
return repeater()
repeater()
应用无法获取发件人并出现以下错误:
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1226, "User 'b715fbc9127dd4' has exceeded the 'max_questions' resource (current value: 3600)")
这发生在我允许从本地设备上的 facebook 页面登录未知设备之后。
我很乐意在这里听到任何建议。谢谢!
【问题讨论】:
标签: python mysql selenium heroku facebook-messenger