Utilities#
- nrk_psapi.utils.get_nested_items(data, items_key)[source]#
Get nested items from a dictionary based on the provided items_key.
- nrk_psapi.utils.sanitize_string(s, delimiter='_')[source]#
Sanitize a string to be used as a URL parameter.
- async nrk_psapi.utils.fetch_file_info(url, session=None)[source]#
Retrieve content-length and content-type for the given URL.
- Return type:
- Parameters:
- async nrk_psapi.utils.tiled_images(image_urls, tile_size=100, columns=3, aspect_ratio=None, *, session=None)[source]#
Generate a tiled image from a list of image URLs.
- Parameters:
tile_size (
int) – Size of each tile in pixels.columns (
int) – Number of columns in the tiled image.aspect_ratio (
str|None) – Desired aspect ratio of the resulting image, e.g. “16:9”. If not provided, the aspect ratio will be a result of the number of image_urls divided by columns.session (
ClientSession|None) – Optional aiohttp session to use. If not provided, a new session will be created.
- Return type: