ocrd_network.utils module

ocrd_network.utils.call_sync(func)[source]
ocrd_network.utils.calculate_execution_time(start: datetime, end: datetime) int[source]

Calculates the difference between ‘start’ and ‘end’ datetime. Returns the result in milliseconds

ocrd_network.utils.calculate_processing_request_timeout(amount_pages: int, timeout_per_page: float = 20.0) float[source]
ocrd_network.utils.convert_url_to_uds_format(url: str) str[source]
ocrd_network.utils.expand_page_ids(page_id: str) List[source]
ocrd_network.utils.generate_created_time() int[source]
ocrd_network.utils.generate_id() str[source]

Generate the id to be used for processing job ids. Note, workspace_id and workflow_id in the reference WebAPI implementation are produced in the same manner

async ocrd_network.utils.generate_workflow_content(workflow: UploadFile, encoding: str = 'utf-8')[source]
ocrd_network.utils.generate_workflow_content_hash(workflow_content: str, encoding: str = 'utf-8')[source]
ocrd_network.utils.is_url_responsive(url: str, tries: int = 1, wait_time: int = 3) bool[source]
ocrd_network.utils.load_ocrd_all_tool_json()[source]
ocrd_network.utils.post_to_callback_url(logger, callback_url: str, result_message: OcrdResultMessage)[source]
ocrd_network.utils.get_ocrd_workspace_instance(mets_path: str, mets_server_url: str | None = None) Workspace[source]
ocrd_network.utils.get_ocrd_workspace_physical_pages(mets_path: str, mets_server_url: str | None = None) List[str][source]
ocrd_network.utils.is_mets_server_running(mets_server_url: str, ws_dir_path: str | None = None) bool[source]
ocrd_network.utils.stop_mets_server(mets_server_url: str, ws_dir_path: str | None = None) bool[source]
ocrd_network.utils.get_uds_path(ws_dir_path: str) Path[source]