def re_record_document_fields(browser, abstract, document): abstract.drop_last_entry() browser.refresh() record_comments(abstract, document) record_empty_values(abstract, ['effective date', 'volume', 'document link']) medium_nap() record_document_fields(browser, abstract, document)
def check_file_size(download_path): if os.path.isfile(download_path): return True else: # long_nap() # Changed 12/03/21 medium_nap() if os.path.isfile(download_path): return True else: return False
def record_document_fields(browser, abstract, document): document_tables = access_document_tables(browser, abstract, document) if execution_review: medium_nap( ) # Adding a flag instead of having to comment the line our every time for review # should probably be it's own function if continue using in this manner display_all_information(browser, abstract, document) aggregate_document_information(browser, abstract, document_tables, document) # record_comments(dataframe, document) # Moved after 'handle_document_image_status' integration scroll_to_top(browser)
def handle_document_image_status(browser, abstract, document): image_container_text = access_image_container(browser, abstract, document) if (image_container_text == abstract.county.messages["No Image Available"] or image_container_text == abstract.county.messages["Login Error"]): document.image_available = False print(f'No document image exists for ' f'{document.extrapolate_value()}, please review.') no_document_image(abstract, document) medium_nap() return False else: wait_for_pdf_to_load(browser, abstract, document) return True
def prepare_file_for_download(abstract, document): if check_file_size(document.download_path): os.rename(document.download_value, document.new_name) check_download_size(document.new_name, document) return True elif os.path.isfile(f'{abstract.document_directory}/{document.new_name}'): check_download_size(document.new_name, document) return True else: # raise ValueError("%s isn't a file!" % document.download_path) print(f'Expected Download Path: {document.download_path}') print(f'Is File?: {abstract.document_directory}/{document.new_name}') print('Encountered an issue preparing file for download for ' f'{document.extrapolate_value()}, trying again...') medium_nap() return False
def wait_for_pdf_to_load(browser, abstract, document): while access_pdf_load_status(browser, abstract, document).startswith( abstract.county.messages["Loading"]): medium_nap()