Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Lipizzanerheimat App, Austria #3411

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

wehrmannit
Copy link

  • Add support for Lipizzanerheimat, Austria

  • Format documentation

  • reformatting + ./update_docu_links.py

Uses guest credentials that were provided in the code.

Town Website
Bärnbach baernbach.gv.at
Edelschrott edelschrott.gv.at
Geistthal-Södingberg geistthal-soedingberg.at
Hirschegg-Pack hirschegg-pack.gv.at
Kainach kainach.at
Köflach koeflach.at
Krottendorf-Gaisfeld krottendorf-gaisfeld.gv.at
Ligist ligist.gv.at
Maria Lankowitz maria-lankowitz.at
Mooskirchen mooskirchen.at
Rosental a.d Kainach rosental-kainach.at
Sankt Martin am Wöllmißberg st-martin-woellmissberg.gv.at
Söding-Sankt Johann soeding-st-johann.gv.at
Stallhofen stallhofen.gv.at
Voitsberg voitsberg.gv.at

TEST_CASES = {
# "Köflach - Debug": {"debug": True},
"Köflach - Endgasse": {"town": "Köflach", "street": "Endgasse"},
"Voitsberg - Bahnweg": {"garbage_calendar_id": 2437, },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voitsberg - Bahnweg seems to fail


HOW_TO_GET_ARGUMENTS_DESCRIPTION = { # Optional dictionary to describe how to get the arguments, will be shown in the GUI configuration form above the input fields, does not need to be translated in all languages
"en": "Open the Lipizzanerheimat app, login or use guest mode, select your town, go to the garbage calendar view and select the street you want to get the garbage collection dates for. You can either provide the calendar name in the lower center, the street name and town as written in the dropdown or provide the garbage_calendar_id directly.",
"de": "Öffnen Sie die Lipizzanerheimat-App, melden Sie sich an oder nutzen Sie den Gastmodus, wählen Sie Ihre Stadt aus, gehen Sie zur Ansicht des Müllkalenders und wählen Sie die Straße aus, für die Sie die Müllabfuhrtermine erhalten möchten. Sie können entweder den Kalendernamen in der unteren Mitte, den Straßennamen und die Stadt, wie sie im Dropdown-Menü geschrieben sind, oder direkt die garbage_calendar_id angeben.", "it": "COME OTTENERE GLI ARGOMENTI",
Copy link
Collaborator

@5ila5 5ila5 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "it": "COME OTTENERE GLI ARGOMENTI",

Comment on lines +230 to +231
def sha1(self, input_str):
return hashlib.sha1(input_str.encode('utf-8')).hexdigest()
Copy link
Collaborator

@5ila5 5ila5 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redefinition can be removed


def _first_setup(self):

r = requests.get(API_URL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this request? r is never accessed, and you don't use a session so this does just nothing but an unnecessary web request

def __init__(self, garbage_calendar_id: int | None = None, street: str | None = None, town: str | None = None, map_name: str | None = None):

self.items = []
self.icons = []
Copy link
Collaborator

@5ila5 5ila5 Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icons should be a dict not a list

Comment on lines +261 to +262
return next((c['garbage_calendar_id']
for c in calendarData['garbage_calendars'] if c['garbage_calendar_title'] == self.map_name), None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to raise an Exception instead of returning None? You could even provide alternative map_names when raising SourceArgumentNotFoundWithSuggestions

Comment on lines +281 to +282
return next((c['garbage_calendars_available'][0]
for c in calendarData['street_structure'] if c['garbage_calendar_street'] == self.street), None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants