bin neu hier und habe von Python fast keine Ahnung.
Habe ein Skript, das ein Formular absendet und es soll danach nach einem text gesucht werden, um festzustellen ob es geklappt hat.
Läuft auf Debian 10 mit Python 3.7
Auszug aus dem Skript:
Code: Alles auswählen
import importlib
import mechanicalsoup
import time
import ssl
import re
...
# Browser options
browser = mechanicalsoup.StatefulBrowser(
soup_config={'features': 'lxml'}, # Use the lxml HTML parser
raise_on_404=True,
user_agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.2228.0 Safari/537.36',
)
...
browser.select_form(nr=00)
browser.submit_selected()
# Check if OK
if LOG_FILE:
ts = time.strftime("%d.%m.%Y %H:%M:%S") # Zeitstempel für das Log (19.10.2016 12:51:30)
f1 = open(LOG_FILE, 'a+')
host_id = after(str_host, "?") # Alle Zeichen nach dem ?
#host_id = str_host
#if browser.response().read().find("Update will be applied") >= 0:
if browser.page.find_all("Update will be applied") >= 0:
Code: Alles auswählen
if browser.page.find_all("Update will be applied") >= 0:
AttributeError: 'StatefulBrowser' object has no attribute 'page'