modified: .dockerignore
modified: src/main.py modified: src/moj_licznik.py modified: .dockerignore modified: src/CHANGELOG.md modified: src/config.yaml modified: src/main.py modified: src/moj_licznik.py
This commit is contained in:
@@ -2,6 +2,7 @@ env/
|
|||||||
__pycache__
|
__pycache__
|
||||||
src/database.sqlite
|
src/database.sqlite
|
||||||
src/config.ini
|
src/config.ini
|
||||||
|
config.ini
|
||||||
import.py
|
import.py
|
||||||
check.py
|
check.py
|
||||||
Dockerfile
|
Dockerfile
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
## v0.1.0 [2023-10-21]
|
## v0.1.0 [2023-10-21]
|
||||||
- Wersja beta
|
- Wersja beta
|
||||||
|
## v0.1.1 [2023-10-22]
|
||||||
|
- Dodano obsługe błędnego logowania
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
name: "Energa meter"
|
name: "Energa meter"
|
||||||
description: "Energa meter addon"
|
description: "Energa meter addon"
|
||||||
version: "0.1.0"
|
version: "0.1.1"
|
||||||
slug: "energa_meter"
|
slug: "energa_meter"
|
||||||
init: false
|
init: false
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ def main():
|
|||||||
mojLicznik = MojLicznik()
|
mojLicznik = MojLicznik()
|
||||||
print(f"Logowanie...", username)
|
print(f"Logowanie...", username)
|
||||||
mojLicznik.login(username, password)
|
mojLicznik.login(username, password)
|
||||||
|
if mojLicznik.loginStatus:
|
||||||
print(f"Aktualizacja liczników...")
|
print(f"Aktualizacja liczników...")
|
||||||
mojLicznik.uppdate_measurments()
|
mojLicznik.uppdate_measurments()
|
||||||
print(f"Wyszukiwanie najstarszych danych...")
|
print(f"Wyszukiwanie najstarszych danych...")
|
||||||
|
|||||||
@@ -110,12 +110,23 @@ class MojLicznik:
|
|||||||
try:
|
try:
|
||||||
response = self.session.post(login_url, data=login_data)
|
response = self.session.post(login_url, data=login_data)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
self.loginStatus = True
|
|
||||||
print(f"Zalogowano")
|
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
print(f"Wystąpił błąd HTTP: {e}")
|
print(f"Wystąpił błąd HTTP: {e}")
|
||||||
|
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|
||||||
|
login_error_text = 'Użytkownik lub hasło niepoprawne'
|
||||||
|
login_error = soup.find('div', text=login_error_text)
|
||||||
|
|
||||||
|
if login_error:
|
||||||
|
self.loginStatus = False
|
||||||
|
print(login_error_text)
|
||||||
|
else:
|
||||||
|
self.loginStatus = True
|
||||||
|
print(f"Zalogowano")
|
||||||
|
|
||||||
select_elements = soup.find_all('script', type='text/javascript')
|
select_elements = soup.find_all('script', type='text/javascript')
|
||||||
meter_isd = []
|
meter_isd = []
|
||||||
for el in select_elements:
|
for el in select_elements:
|
||||||
|
|||||||
Reference in New Issue
Block a user