Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""Försäkringskassan headless-browser scraper — STUB.
|
||||
|
||||
⚠️ DO NOT SHIP without completing the legal/ToS + BankID review (§2.3).
|
||||
|
||||
This stub exists so the FetchDataService interface is complete and all code
|
||||
paths that would use scraping can reference FKScraperService without a real
|
||||
implementation. Enable via settings.scraper_enabled = True ONLY after:
|
||||
1. Legal sign-off on automated access and BankID automation.
|
||||
2. Security review of the sandboxed container setup.
|
||||
3. Explicit product decision to ship scraping publicly.
|
||||
|
||||
Until then, ManualFetchService (fetch_data_service.py) handles all data entry.
|
||||
"""
|
||||
|
||||
from uuid import UUID
|
||||
|
||||
from app.entities.parental_leave import ParentalLeaveFetch
|
||||
from app.services.fetch_data_service import FetchDataService
|
||||
|
||||
_LEGAL_GATE_MSG = (
|
||||
"FK scraping is disabled pending legal/ToS + BankID review. "
|
||||
"See ARCHITECTURE.md §2.3. Set settings.scraper_enabled=True only after sign-off."
|
||||
)
|
||||
|
||||
|
||||
class FKScraperService(FetchDataService):
|
||||
async def get_latest(
|
||||
self, personal_data_uuid: UUID, child_id: UUID
|
||||
) -> ParentalLeaveFetch | None:
|
||||
raise NotImplementedError(_LEGAL_GATE_MSG)
|
||||
|
||||
async def list_history(
|
||||
self, personal_data_uuid: UUID, child_id: UUID
|
||||
) -> list[ParentalLeaveFetch]:
|
||||
raise NotImplementedError(_LEGAL_GATE_MSG)
|
||||
|
||||
async def start_bankid_session(self) -> str:
|
||||
"""Initialize a BankID session and return a QR-code payload for the client."""
|
||||
raise NotImplementedError(_LEGAL_GATE_MSG)
|
||||
|
||||
async def poll_session(self, session_id: str) -> dict:
|
||||
"""Poll auth + fetch status. Returns {status, qr_data, result}."""
|
||||
raise NotImplementedError(_LEGAL_GATE_MSG)
|
||||
|
||||
async def cancel_session(self, session_id: str) -> None:
|
||||
raise NotImplementedError(_LEGAL_GATE_MSG)
|
||||
Reference in New Issue
Block a user