avenu_adapter#
Playwright-based adapter for Avenu Insights WebForms registry platforms (used by Massachusetts registries at masslandrecords.com).
The browser owns session state, cookies, and ViewState — this adapter never touches ASP.NET internals directly.
Classes#
Async adapter for one Avenu WebForms registry session. |
Module Contents#
- class openplaces.io.avenu_adapter.AvenuAdapter(base_url: str, context)#
Async adapter for one Avenu WebForms registry session.
- Parameters:
base_url (str) – Registry home URL, e.g.
https://www.masslandrecords.com/MiddlesexSouth/context (playwright.async_api.BrowserContext) – Playwright browser context (one per registry session).
- async start_session() None#
Navigate to the registry home page and resolve any bot challenge.
- async search(date_from: str, date_to: str, town: str | None = None, doc_type: str | None = None) None#
Submit a date-range search form with optional town and doc-type filters.
- Parameters:
date_from (str) – Start date in
YYYY-MM-DDformat.date_to (str) – End date in
YYYY-MM-DDformat.town (str, optional) – Uppercase town name as displayed in the registry dropdown, e.g.
'ACTON'. PassNoneto search all towns.doc_type (str, optional) – Document type display label, e.g.
'DEED'. PassNoneto search all document types.
- async parse_results(fetch_details: bool = False, debug: bool = False) list[dict]#
Extract all result rows from the current results page.
- Parameters:
fetch_details (bool) – If True, click each row to load the View Details panel and merge its fields (consideration, grantor/grantee, address, etc.) into the returned dict.
debug (bool) – If True, print a per-row trace (index, book, page, whether details loaded, instrument_number) and a summary of rows-seen vs. distinct (book, page). Diagnostic aid for index-desync duplicates; off by default even in verbose ingestion runs.
- Returns:
One dict per data row; header rows are skipped.
- Return type:
list of dict
- async parse_details() dict#
Parse the View Details panel currently visible on the right.
- Returns:
Keys: instrument_number, rec_time, n_pages, doc_status, consideration, street_number, street_name, description, grantor (‘;’-joined), grantee (‘;’-joined), linked_docs (‘;’-joined ‘book/page:type’ strings).
- Return type:
dict
- async has_next_page() bool#
Return True if the pagination Next button is present and enabled.
- async next_page() None#
Navigate to the next results page via the Next postback link.
- async dump_details_candidates() None#
Print frame URLs and locate the “Consideration” label across all frames.
Run this after clicking a row to open View Details, to discover which frame holds the details panel and what container ID to use.
- async open_document(row_element) str | None#
Open the document popup for a result row and return its URL.
- Parameters:
row_element (playwright ElementHandle) – A result row element containing a document link.
- Returns:
The URL of the document popup page, or None if no link found.
- Return type:
str or None