diff --git a/src/ocrd_network/client.py b/src/ocrd_network/client.py index 793d6ead89..ff9ad870e3 100644 --- a/src/ocrd_network/client.py +++ b/src/ocrd_network/client.py @@ -1,3 +1,4 @@ +from typing import Optional from ocrd_utils import config, getLogger, LOG_FORMAT from .client_utils import ( get_ps_deployed_processors, @@ -16,7 +17,7 @@ class Client: def __init__( self, - server_addr_processing: str, + server_addr_processing: Optional[str], timeout: int = config.OCRD_NETWORK_CLIENT_POLLING_TIMEOUT, wait: int = config.OCRD_NETWORK_CLIENT_POLLING_SLEEP ): diff --git a/src/ocrd_network/server_utils.py b/src/ocrd_network/server_utils.py index 8fa13fd714..9d8628170c 100644 --- a/src/ocrd_network/server_utils.py +++ b/src/ocrd_network/server_utils.py @@ -125,14 +125,13 @@ def request_processor_server_tool_json(logger: Logger, processor_server_base_url urljoin(base=processor_server_base_url, url="info"), headers={"Content-Type": "application/json"} ) - if response.status_code != 200: - message = f"Failed to retrieve tool json from: {processor_server_base_url}, code: {response.status_code}" - raise_http_exception(logger, status.HTTP_404_NOT_FOUND, message) - return response.json() except Exception as error: message = f"Failed to retrieve ocrd tool json from: {processor_server_base_url}" raise_http_exception(logger, status.HTTP_404_NOT_FOUND, message, error) - + if response.status_code != 200: + message = f"Failed to retrieve tool json from: {processor_server_base_url}, code: {response.status_code}" + raise_http_exception(logger, status.HTTP_404_NOT_FOUND, message) + return response.json() async def forward_job_to_processor_server( logger: Logger, job_input: PYJobInput, processor_server_base_url: str