Skip to content

Commit

Permalink
remove lazy imports, global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dynasticorpheus committed Jan 19, 2022
1 parent fe0b0a8 commit eb5a966
Show file tree
Hide file tree
Showing 2 changed files with 325 additions and 15 deletions.
19 changes: 4 additions & 15 deletions custom_components/mindergas/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
}
)

LOGIN_URL = "https://www.mindergas.nl/users/sign_in/"
URL_DATA = "https://www.mindergas.nl/member/year_overview/new"
URL_DASHBOARD = "https://www.mindergas.nl/member/dashboard"


def setup_platform(hass, config, add_entities, discovery_info=None):
username = config.get(CONF_USERNAME)
Expand Down Expand Up @@ -80,9 +84,6 @@ def icon(self):

def update(self):

LOGIN_URL = "https://www.mindergas.nl/users/sign_in/"
URL_DATA = "https://www.mindergas.nl/member/year_overview/new"
URL_DASHBOARD = "https://www.mindergas.nl/member/dashboard"
URL_RESULT = "none"
n = 0
while not URL_RESULT == URL_DASHBOARD:
Expand Down Expand Up @@ -173,13 +174,7 @@ def icon(self):
return "mdi:chart-line"

def update(self):
import requests
from bs4 import BeautifulSoup
from lxml import html

LOGIN_URL = "https://www.mindergas.nl/users/sign_in/"
URL_DATA = "https://www.mindergas.nl/member/year_overview/new"
URL_DASHBOARD = "https://www.mindergas.nl/member/dashboard"
URL_RESULT = "none"
n = 0
while not URL_RESULT == URL_DASHBOARD:
Expand Down Expand Up @@ -265,13 +260,7 @@ def icon(self):
return "mdi:chart-line"

def update(self):
import requests
from bs4 import BeautifulSoup
from lxml import html

LOGIN_URL = "https://www.mindergas.nl/users/sign_in/"
URL_DATA = "https://www.mindergas.nl/member/year_overview/new"
URL_DASHBOARD = "https://www.mindergas.nl/member/dashboard"
URL_RESULT = "none"
n = 0
while not URL_RESULT == URL_DASHBOARD:
Expand Down
321 changes: 321 additions & 0 deletions custom_components/mindergas/sensor.py.save

Large diffs are not rendered by default.

0 comments on commit eb5a966

Please sign in to comment.