34 lines
849 B
Python
34 lines
849 B
Python
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
# konfiguracja logowania
|
|
LOGIN_URL = "http://192.168.0.152/mayo2/login.php"
|
|
DANE_LOGOWANIA = {
|
|
"login": "twoj_login",
|
|
"pass": "twoje_haslo",
|
|
"baza": "2", # lub "2"
|
|
}
|
|
|
|
# Tworzymy sesję
|
|
s = requests.Session()
|
|
|
|
# Logujemy się
|
|
resp = s.post(LOGIN_URL, data=DANE_LOGOWANIA)
|
|
if "Zaloguj się" in resp.text:
|
|
print("❌ Logowanie nieudane — sprawdź login/hasło")
|
|
else:
|
|
print("✅ Zalogowano poprawnie")
|
|
|
|
# Pobieramy stronę po zalogowaniu
|
|
url = "http://192.168.0.152/mayo2/index.php?id_zestawu=32574&id_zamowienia=7466&modul=14&pozycja="
|
|
page = s.get(url)
|
|
page.encoding = "utf-8"
|
|
|
|
soup = BeautifulSoup(page.text, "html.parser")
|
|
|
|
# Szukamy modelu
|
|
model_input = soup.find("input", {"name": "s_nr_kat"})
|
|
model = model_input.get("value") if model_input else None
|
|
|
|
print("Model:", model)
|