improve lodur einsatz detection
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Tobias Brunner 2021-02-27 14:30:40 +01:00
parent f3acbd7ffd
commit 888508d1c6
5 changed files with 12 additions and 11 deletions

View File

@ -2,6 +2,6 @@
Pylokid. From Mail to Lodur - all automated.
"""
__version__ = "3.0.0"
__version__ = "3.0.1"
__git_version__ = "0"
__url__ = "https://github.com/tobru/pylokid"

View File

@ -4,4 +4,7 @@ Helper module to run not-installed version (via ``python3 -m pylokid``)
from pylokid.main import main
if __name__ == "__main__":
main()
try:
main()
except KeyboardInterrupt:
print("Byebye")

View File

@ -69,7 +69,12 @@ class Lodur:
if state == "open":
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:
lodur_id = re.search(
".*event=([0-9]{1,})&.*", einsatzrapport_url["href"]

View File

@ -247,10 +247,3 @@ def main():
# repeat every
logger.info("Waiting %s seconds until next check", IMAP_CHECK_INTERVAL)
time.sleep(int(IMAP_CHECK_INTERVAL))
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("Byebye")

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pylokid"
version = "3.0.0"
version = "3.0.1"
description = ""
authors = ["Tobias Brunner <tobias@tobru.ch>"]
license = "MIT"