scopesim.server.download_utils module

Used only by the database and github_utils submodules.

exception scopesim.server.download_utils.ServerError[source]

Bases: Exception

Some error with the server or connection to the server.

scopesim.server.download_utils.create_client(base_url, cached: bool = False, cache_name: str = '')[source]

Create httpx Client instance, should support cache at some point.

scopesim.server.download_utils.get_server_folder_contents(client, dir_name: str, unique_str: str = '.zip$') Iterator[str][source]

Find all zip files in a given server folder.

scopesim.server.download_utils.handle_download(client, pkg_url: str, save_path: Path, pkg_name: str, padlen: int, chunk_size: int = 128, disable_bar=False) None[source]

Perform a streamed download and write the content to disk.

scopesim.server.download_utils.handle_unzipping(save_path: Path, save_dir: Path, pkg_name: str, padlen: int) None[source]

Unpack a zipped folder, usually called right after downloading.

scopesim.server.download_utils.send_get(client, sub_url, stream: bool = False)[source]

Send a GET request (streamed or not) using an existing client.

The point of this function is mostly elaborate exception handling.