def fetch_parsed_case(case_id: str) -> Tuple[str, str]:
    query_result = fetch_page.query_case_id(case_id)
    if query_result is None:
        return None
    result_page, register_page = query_result
    result_soup = BeautifulSoup(result_page, "html.parser")
    register_soup = BeautifulSoup(register_page, "html.parser")

    register_url = get_register_url(result_soup)
    status, type = get_status_and_type(result_soup)

    if status.lower() not in statuses_map:
        load_dotenv()
        if os.getenv("LOCAL_DEV") != "true":
            log_and_email(
                f"Case {case_id} has status '{status}', which is not in our list of known statuses.",
                "Found Unknown Status",
                error=True)
        else:
            logger.info(
                f"Case {case_id} has status '{status}', which is not in our list of known statuses."
            )

    return make_parsed_case(soup=register_soup,
                            status=status,
                            type=type,
                            register_url=register_url)
Example #2
0
def fetch_parsed_case(case_id: str) -> Tuple[str, str]:
    query_result = fetch_page.query_case_id(case_id)
    if query_result is None:
        return None
    result_page, register_page = query_result
    result_soup = BeautifulSoup(result_page, "html.parser")
    register_soup = BeautifulSoup(register_page, "html.parser")

    register_url = get_register_url(result_soup)
    status = get_status(result_soup)
    return make_parsed_case(soup=register_soup,
                            status=status,
                            register_url=register_url)
 def test_query_case_id(self):
     search_page_content, register_page_content = fetch_page.query_case_id(
         "1JC-21-0116"
     )
     assert "04/27/2020" in register_page_content
 def test_query_case_id(self):
     search_page_content, register_page_content = fetch_page.query_case_id(
         "J1-CV-20-001590"
     )
     assert "04/27/2020" in register_page_content