def test_url_for_register(self):
     parsed = fetch_page.fetch_parsed_case("J1-CV-20-001590")
     assert (
         parsed["register_url"]
         == "https://odysseypa.traviscountytx.gov/JPPublicAccess/CaseDetail.aspx?CaseID=2286743"
     )
     assert parsed["status"] == "Final Status"
示例#2
0
def make_case_list(ids_to_parse: List[str]) -> List[Dict[str, Any]]:
    """Gets case details for each case number in `ids_to_parse`"""

    parsed_cases, failed_ids = [], []
    for id_to_parse in ids_to_parse:
        new_case = fetch_page.fetch_parsed_case(id_to_parse)
        if new_case:
            parsed_cases.append(new_case)
        else:
            failed_ids.append(id_to_parse)

    if failed_ids:
        error_message = f"Failed to scrape data for {len(failed_ids)} case numbers. Here they are:\n{', '.join(failed_ids)}"
        log_and_email(error_message, "Failed Case Numbers", error=True)

    return parsed_cases