예제 #1
0
 def prepare_and_get_output_excel_path(path_to_destination_directory):
     fs = FileSystem()
     full_path_to_template = fs.absolute_path(
         config.PATH_TO_EXCEL_OUTPUT_TEMPLATE_FILE)
     file_name = fs.get_file_name(full_path_to_template)
     source_path = full_path_to_template
     destination_path = fs.join_path(path_to_destination_directory,
                                     file_name)
     fs.copy_file(destination=destination_path, source=source_path)
     return destination_path
예제 #2
0
def download_order_file(url: str, filename: str, download_path: str):
    print("___attemting to download order file___")
    try:
        browser = Browser.Browser()
        fileSystem = FileSystem()
        fileSystem.create_directory(download_path)
        browser.new_browser(downloadsPath=download_path)
        browser.new_context(acceptDownloads=True)
        browser.new_page()
        order_file_download = browser.download(url)
        orders_csv_filepath_origin = order_file_download.get("saveAs")
        orders_csv_filepath = download_path + filename
        fileSystem.wait_until_created(orders_csv_filepath_origin)
        fileSystem.copy_file(source=orders_csv_filepath_origin,
                             destination=orders_csv_filepath)
    except Exception as errorMessage:
        print("Unable to download order file: " + str(errorMessage))
    finally:
        browser.playwright.close()
    print("_____complete download____")