Compare commits
2 commits
e9fbf09a35
...
e1ff78118d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1ff78118d | ||
|
|
c971d90595 |
1 changed files with 11 additions and 2 deletions
|
|
@ -59,11 +59,12 @@ def download_page(code):
|
|||
"""
|
||||
Downloads the page from proxiwash website
|
||||
"""
|
||||
url = WASHINSA_URL + code
|
||||
try:
|
||||
with urllib.request.urlopen(WASHINSA_URL + code) as response:
|
||||
with urllib.request.urlopen(url) as response:
|
||||
return response.read().decode()
|
||||
except:
|
||||
print("Error processing following url: " + WASHINSA_URL)
|
||||
print("Error processing following url: " + url)
|
||||
return ""
|
||||
|
||||
|
||||
|
|
@ -85,6 +86,13 @@ def is_machine_dryer(row):
|
|||
return DRYER_STRING in row.contents[0].text
|
||||
|
||||
|
||||
def get_machine_weight(row):
|
||||
"""
|
||||
Find the maximum weight supported by the machine.
|
||||
"""
|
||||
return int(re.search("LINGE (.*?) KG", row.contents[0].text).group(1))
|
||||
|
||||
|
||||
def get_machine_number(row):
|
||||
"""
|
||||
Gets the current machine number.
|
||||
|
|
@ -184,6 +192,7 @@ def get_parsed_data(rows):
|
|||
machine = {
|
||||
"number": get_machine_number(row),
|
||||
"state": state.value,
|
||||
"maxWeight ": get_machine_weight(row),
|
||||
"startTime": "",
|
||||
"endTime": "",
|
||||
"donePercent": "",
|
||||
|
|
|
|||
Loading…
Reference in a new issue