mlso-api-client package

Submodules

mlso.api.client module

Module defining the Python and command line client.

exception mlso.api.client.ServerError[source]

Bases: Exception

Exception raised when there is a problem with the server not returning a valid result.

exception mlso.api.client.UserNotFound[source]

Bases: Exception

Exception raised when a username is found in the registration database.

mlso.api.client.about(base_url: str = 'http://api.mlso.ucar.edu:5000', api_version: str = 'v1', verbose: bool = False)[source]

Retrieve the results of the /about endpoint.

mlso.api.client.authenticate(username: str = None, base_url: str = 'http://api.mlso.ucar.edu:5000', api_version: str = 'v1', verbose: bool = False)[source]

Authenticate username within the session. This must be called before download_file.

mlso.api.client.download_file(file, output_dir)[source]

Download a single file to the given output directory. The file argument is a dict with fields “url” and “filename”. output_dir is simply the directory to put the downloaded file. Can raise ServerError if there is a problem with the web request.

mlso.api.client.files(instrument: str, product: str, filters: list[dict[str, str]] | None = None, base_url: str = 'http://api.mlso.ucar.edu:5000', api_version: str = 'v1', verbose=False)[source]

Handle retrieving the /instruments/{instrument}/products/{product} endpoint results. Can raise ServerError if there is a problem with the web request. Use download_file to download the file(s) returned with routine.

mlso.api.client.instruments(base_url: str = 'http://api.mlso.ucar.edu:5000', api_version: str = 'v1', verbose: bool = False)[source]

Retrieve list of instruments from the /instruments/{instrument} endpoint with some of their properties.

mlso.api.client.main()[source]

Entry point for MLSO API command-line utility.

mlso.api.client.products(instrument, base_url: str = 'http://api.mlso.ucar.edu:5000', api_version: str = 'v1', verbose: bool = False)[source]

Handle retrieving the /instruments/{instrument}/products endpoint results. Can raise ServerError if there is a problem with the web request.

mlso.api.client.sizeof_fmt(n_bytes: int) str[source]

Human friendly file size