improve lodur einsatz detection
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f3acbd7ffd
commit
888508d1c6
|
@ -2,6 +2,6 @@
|
||||||
Pylokid. From Mail to Lodur - all automated.
|
Pylokid. From Mail to Lodur - all automated.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "3.0.0"
|
__version__ = "3.0.1"
|
||||||
__git_version__ = "0"
|
__git_version__ = "0"
|
||||||
__url__ = "https://github.com/tobru/pylokid"
|
__url__ = "https://github.com/tobru/pylokid"
|
||||||
|
|
|
@ -4,4 +4,7 @@ Helper module to run not-installed version (via ``python3 -m pylokid``)
|
||||||
from pylokid.main import main
|
from pylokid.main import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
try:
|
||||||
|
main()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Byebye")
|
||||||
|
|
|
@ -69,7 +69,12 @@ class Lodur:
|
||||||
if state == "open":
|
if state == "open":
|
||||||
self.browser.open("{}?modul=36".format(self.url))
|
self.browser.open("{}?modul=36".format(self.url))
|
||||||
|
|
||||||
einsatzrapport_url = self.browser.find_link(link_text=f_id)
|
try:
|
||||||
|
einsatzrapport_url = self.browser.find_link(link_regex=re.compile(f_id))
|
||||||
|
except mechanicalsoup.LinkNotFoundError:
|
||||||
|
self.logger.error("[%s] No Einsatzrapport found in Lodur", f_id)
|
||||||
|
return None
|
||||||
|
|
||||||
if einsatzrapport_url:
|
if einsatzrapport_url:
|
||||||
lodur_id = re.search(
|
lodur_id = re.search(
|
||||||
".*event=([0-9]{1,})&.*", einsatzrapport_url["href"]
|
".*event=([0-9]{1,})&.*", einsatzrapport_url["href"]
|
||||||
|
|
|
@ -247,10 +247,3 @@ def main():
|
||||||
# repeat every
|
# repeat every
|
||||||
logger.info("Waiting %s seconds until next check", IMAP_CHECK_INTERVAL)
|
logger.info("Waiting %s seconds until next check", IMAP_CHECK_INTERVAL)
|
||||||
time.sleep(int(IMAP_CHECK_INTERVAL))
|
time.sleep(int(IMAP_CHECK_INTERVAL))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("Byebye")
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pylokid"
|
name = "pylokid"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Tobias Brunner <tobias@tobru.ch>"]
|
authors = ["Tobias Brunner <tobias@tobru.ch>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
Loading…
Reference in a new issue