TransportAPIClient

from carmen_cloud_client import TransportAPIClient

A client for the Adaptive Recognition Cloud Transportation & Cargo API. Use it to send images of containers, railway wagons and vehicles with US DOT codes to the API and get the recognized codes back.

Args: options (TransportAPIOptions): An instance of TransportAPIOptions containing the necessary options for the API request.

Raises: TransportAPIConfigError: If the provided options are invalid.

Fields​

NameTypeDefault
supported_api_versionstr'1.0.1'

Methods​

Constructor​

def __init__(self, options: TransportAPIOptions)

send​

def send(self, *image_data_or_paths: Union[str, bytes, BytesIO]) -> TransportationCargoApiResponse

Sends one or more images to the API and returns the recognized codes.

Args: *image_data_or_paths (Union[str, bytes, BytesIO]): One or more image paths or bytes-like objects to send to the API.

Returns: dict: A dictionary containing the recognized codes.

Raises: TransportAPIConfigError: If the provided options are invalid or if the API request fails.

validate_options​

def validate_options(self)

get_image_bytes​

def get_image_bytes(self, image_data_or_path: Union[str, bytes, BytesIO]) -> Union[bytes, BytesIO]

create_headers​

def create_headers(self, content_type) -> dict

create_form_data​

def create_form_data(self, image_data_or_paths: List[Union[str, bytes, BytesIO]]) -> MultipartEncoder

get_parametrized_api_url​

def get_parametrized_api_url(self) -> str