* DB: users + user_profiles/filters/notifications/preferences; applications gets user_id + forensics_json + profile_snapshot_json; new errors table with 14d retention; schema versioning via MIGRATIONS list * auth: password hashes in DB (argon2); env vars seed first admin; per-user sessions; CSRF bound to user id * apply: personal info/WBS moved out of env into the request body; providers take an ApplyContext with Profile + submit_forms; full Playwright recorder (step log, console, page errors, network, screenshots, final HTML) * web: five top-level tabs (Wohnungen/Bewerbungen/Logs/Fehler/Einstellungen); settings sub-tabs profil/filter/benachrichtigungen/account/benutzer; per-user matching, auto-apply and notifications (UI/Telegram/SMTP); red auto-apply switch on Wohnungen tab; forensics detail view for bewerbungen and fehler; retention background thread Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
2.7 KiB
Python
69 lines
2.7 KiB
Python
import logging
|
|
|
|
from actions import open_page
|
|
from classes.application_result import ApplicationResult
|
|
from language import _
|
|
from providers._provider import ApplyContext, Provider
|
|
|
|
logger = logging.getLogger("flat-apply")
|
|
|
|
|
|
class Gesobau(Provider):
|
|
@property
|
|
def domain(self) -> str:
|
|
return "gesobau.de"
|
|
|
|
async def apply_for_flat(self, url: str, ctx: ApplyContext) -> ApplicationResult:
|
|
r = ctx.recorder
|
|
p = ctx.profile
|
|
if not (p.immomio_email and p.immomio_password):
|
|
r.step("immomio_creds_missing", "warn")
|
|
return ApplicationResult(False, _("missing_fields"))
|
|
|
|
async with open_page(url, recorder=r) as page:
|
|
r.step("extract.immomio_link")
|
|
immomio_link = await page.get_by_role("link", name="Jetzt bewerben").get_attribute("href")
|
|
|
|
r.step("auth.goto"); await page.goto("https://tenant.immomio.com/de/auth/login")
|
|
await page.wait_for_timeout(1000)
|
|
|
|
r.step("auth.login")
|
|
await page.locator('input[name="email"]').fill(p.immomio_email)
|
|
await page.get_by_role("button", name="Anmelden").click()
|
|
await page.wait_for_timeout(1000)
|
|
await page.locator("#password").fill(p.immomio_password)
|
|
await page.locator("#kc-login").click()
|
|
await page.wait_for_timeout(1000)
|
|
|
|
r.step("back.to_immomio", detail=immomio_link or "")
|
|
await page.goto(immomio_link)
|
|
await page.wait_for_timeout(1000)
|
|
|
|
r.step("cookies.check")
|
|
cookie_accept_btn = page.get_by_role("button", name="Alle erlauben")
|
|
if await cookie_accept_btn.is_visible():
|
|
await cookie_accept_btn.click()
|
|
|
|
r.step("apply.click"); await page.get_by_role("button", name="Jetzt bewerben").click()
|
|
await page.wait_for_timeout(3000)
|
|
|
|
r.step("already_applied.check")
|
|
if page.url == "https://tenant.immomio.com/de/properties/applications":
|
|
return ApplicationResult(False, message=_("already_applied"))
|
|
|
|
r.step("answer_questions.click")
|
|
answer_questions_btn = page.get_by_role("button", name="Fragen beantworten")
|
|
if await answer_questions_btn.is_visible():
|
|
await answer_questions_btn.click()
|
|
await page.wait_for_timeout(2000)
|
|
|
|
if await answer_questions_btn.is_visible():
|
|
await answer_questions_btn.click()
|
|
await page.wait_for_timeout(2000)
|
|
|
|
r.step("success.check")
|
|
if not await answer_questions_btn.is_visible():
|
|
return ApplicationResult(True)
|
|
|
|
r.step("success.not_found", "warn")
|
|
return ApplicationResult(False, _("submit_conformation_msg_not_found"))
|