add gewobag form

This commit is contained in:
Aron Petau 2026-01-05 19:08:39 +01:00
parent bc06db593b
commit a072899cfd

View file

@ -180,27 +180,45 @@ class GewobagHandler(BaseHandler):
except Exception as e:
logger.warning(f"[GEWOBAG] Could not fill Ort: {e}")
# Anzahl der einziehenden Erwachsenen
# Gesamtzahl der einziehenden Personen (Erwachsene + Kinder) - REQUIRED
try:
anzahl_erwachsene = os.environ.get("FORM_ADULTS", "1")
adults_input = await iframe_page.query_selector('#formly_3_input_gewobag_anzahl_erwachsene_0')
if adults_input:
await adults_input.fill(anzahl_erwachsene)
logger.info(f"[GEWOBAG] Filled Anzahl Erwachsene: {anzahl_erwachsene}")
anzahl_erwachsene = int(os.environ.get("FORM_ADULTS", "1"))
anzahl_kinder = int(os.environ.get("FORM_CHILDREN", "0"))
total_persons = str(anzahl_erwachsene + anzahl_kinder)
total_input = await iframe_page.query_selector('#formly_2_input_gewobag_gesamtzahl_der_einziehenden_personen_erwachsene_und_kinder_0')
if total_input:
await total_input.fill(total_persons)
logger.info(f"[GEWOBAG] Filled Gesamtzahl Personen: {total_persons}")
form_filled = True
except Exception as e:
logger.warning(f"[GEWOBAG] Could not fill Anzahl Erwachsene: {e}")
logger.warning(f"[GEWOBAG] Could not fill Gesamtzahl Personen: {e}")
# Anzahl der einziehenden Kinder
# "Für wen wird die Wohnungsanfrage gestellt?" dropdown - REQUIRED
# Select "für mich selbst" (for myself)
try:
anzahl_kinder = os.environ.get("FORM_CHILDREN", "0")
children_input = await iframe_page.query_selector('#formly_3_input_gewobag_anzahl_kinder_1')
if children_input:
await children_input.fill(anzahl_kinder)
logger.info(f"[GEWOBAG] Filled Anzahl Kinder: {anzahl_kinder}")
dropdown_input = await iframe_page.query_selector('#formly_9_select_gewobag_fuer_wen_wird_die_wohnungsanfrage_gestellt_0')
if dropdown_input:
await dropdown_input.click()
await iframe_page.wait_for_timeout(300)
# Select the first option "für mich selbst"
for_myself_option = await iframe_page.query_selector('.ng-option:has-text("für mich selbst")')
if for_myself_option:
await for_myself_option.click()
logger.info("[GEWOBAG] Selected 'für mich selbst'")
form_filled = True
except Exception as e:
logger.warning(f"[GEWOBAG] Could not select 'für wen' dropdown: {e}")
# Mobilfunknummer (Mobile phone) - REQUIRED
try:
mobile_phone = os.environ.get("FORM_PHONE", "")
mobile_input = await iframe_page.query_selector('#formly_17_input_$$_telephone_number_$$_0')
if mobile_input:
await mobile_input.fill(mobile_phone)
logger.info(f"[GEWOBAG] Filled Mobilfunknummer: {mobile_phone}")
form_filled = True
except Exception as e:
logger.warning(f"[GEWOBAG] Could not fill Anzahl Kinder: {e}")
logger.warning(f"[GEWOBAG] Could not fill Mobilfunknummer: {e}")
# WBS (Wohnberechtigungsschein) - Click "Ja" radio button
try:
@ -212,25 +230,15 @@ class GewobagHandler(BaseHandler):
except Exception as e:
logger.warning(f"[GEWOBAG] Could not select WBS: {e}")
# Privacy checkbox 1 (WBS data consent)
# Privacy checkbox (Main Datenschutzbestimmungen) - REQUIRED
try:
privacy_checkbox_1 = await iframe_page.query_selector('#formly_20_checkbox_gewobag_datenschutzhinweis_iv0027_bestaetigt_0')
if privacy_checkbox_1:
await privacy_checkbox_1.check()
logger.info("[GEWOBAG] Checked privacy checkbox 1 (WBS data consent)")
privacy_checkbox = await iframe_page.query_selector('#formly_20_checkbox_gewobag_datenschutzhinweis_bestaetigt_0')
if privacy_checkbox:
await privacy_checkbox.check()
logger.info("[GEWOBAG] Checked privacy checkbox (Datenschutzbestimmungen)")
form_filled = True
except Exception as e:
logger.warning(f"[GEWOBAG] Could not check privacy checkbox 1: {e}")
# Privacy checkbox 2 (Main Datenschutzbestimmungen)
try:
privacy_checkbox_2 = await iframe_page.query_selector('#formly_21_checkbox_gewobag_datenschutzhinweis_bestaetigt_0')
if privacy_checkbox_2:
await privacy_checkbox_2.check()
logger.info("[GEWOBAG] Checked privacy checkbox 2 (Datenschutzbestimmungen)")
form_filled = True
except Exception as e:
logger.warning(f"[GEWOBAG] Could not check privacy checkbox 2: {e}")
logger.warning(f"[GEWOBAG] Could not check privacy checkbox: {e}")
await asyncio.sleep(1)