snap_python.components.store
- class snap_python.components.store.StoreEndpoints(base_url: str, version: str, headers: dict[str, str] = None)
Bases:
object
Query snap store that is available at <base_url> for information about snaps. Calls made directly with store to enable querying the non-default snap store for information. Snapd only supports the store at snapcraft.io
Certain functionality is not available in snapd, such as querying for/by categories
- async find(query: str | None = None, fields: list[str] | None = None, name_startswith: str | None = None, architecture: str | None = None, common_id: str | None = None, category: str | None = None, channel: str | None = None, confiement: str | None = None, featured: bool = False, private: bool = False, publisher: str | None = None, headers: dict[str, str] | None = None) SearchResponse
Search for snaps in the store.
- Parameters:
query (str, optional) – The search query.
fields (list[str], optional) – The fields to include in the response.
name_startswith (str, optional) – Filter snaps by name prefix.
architecture (str, optional) – Filter snaps by architecture.
common_id (str, optional) – Filter snaps by common ID.
category (str, optional) – Filter snaps by category.
channel (str, optional) – Filter snaps by channel.
confiement (str, optional) – Filter snaps by confinement.
featured (bool, optional) – Filter snaps by featured status.
private (bool, optional) – Filter snaps by private status.
publisher (str, optional) – Filter snaps by publisher.
headers (dict[str, str], optional) – Additional headers to include in the request.
- Returns:
The search response.
- Return type:
- Raises:
ValueError – If invalid fields are provided.
- async get_all_snaps_for_arch(arch: str) ArchSearchResponse
Get all snaps for a given architecture.
- Parameters:
arch (str) – The architecture.
- Returns:
The search response.
- Return type:
- Raises:
ValueError – If invalid architecture is provided.
- async get_categories(type: str | None = None, fields: list[str] | None = None) CategoryResponse
Get categories of snaps.
- Parameters:
type (str, optional) – The type of categories.
fields (list[str], optional) – The fields to include in the response.
- Returns:
The categories.
- Return type:
- Raises:
ValueError – If invalid fields are provided.
- async get_category_by_name(name: str, fields: list[str] | None = None) SingleCategoryResponse
Get a category by name.
- Parameters:
name (str) – The name of the category.
fields (list[str], optional) – The fields to include in the response.
- Returns:
The category.
- Return type:
- Raises:
ValueError – If invalid fields are provided.
- async get_many_snap_revision_info(snap_name: str, from_revision: int, to_revision: int, arch: str, fields=None) RefreshRevisionResponse
Get information about a snap revision.
- Parameters:
snap_name (str) – The name of the snap.
revision (int) – The revision of the snap.
arch (str) – The architecture of the snap to retrieve details about (e.g. amd64, arm64, riscv64, etc).
- Returns:
The snap revision information.
- Return type:
- async get_snap_details(snap_name: str, fields: list[str] | None = None)
Get details of a snap.
- Parameters:
snap_name (str) – The name of the snap.
fields (list[str], optional) – The fields to include in the response.
- Returns:
The snap details.
- Return type:
dict
- Raises:
ValueError – If invalid fields are provided.
- async get_snap_info(snap_name: str, fields: list[str] | None = None) InfoResponse
Get information about a snap.
- Parameters:
snap_name (str) – The name of the snap.
fields (list[str], optional) – The fields to include in the response.
- Returns:
The snap information.
- Return type:
- Raises:
ValueError – If invalid fields are provided.
- async get_snap_revision_info(snap_name: str, revision: int, arch: str, fields=None) RefreshRevisionResponse
Get information about a snap revision.
- Parameters:
snap_name (str) – The name of the snap.
revision (int) – The revision of the snap.
arch (str) – The architecture of the snap to retrieve details about (e.g. amd64, arm64, riscv64, etc).
- Returns:
The snap revision information.
- Return type:
- async get_snap_search_paginated(q: str = '', scope: str = 'wide', arch: str = 'wide', page: int = 1, limit: int = 100, confinement: str = 'strict,classic') PaginatedSnapSearchResponse
- async get_top_snaps_from_category(category: str) SearchResponse
Get top snaps from a category.
- Parameters:
category (str) – The category name.
- Returns:
The search response.
- Return type:
- async get_track_risk_map(snap_name: str) dict[str, dict[str, TrackRiskMap]]
Get the track risk map for a snap.
- Parameters:
snap_name (str) – The name of the snap.
- Returns:
A dictionary mapping tracks to their risk maps.
- Return type:
dict[str, TrackRiskMap]
- retry_get_snap_info(snap_name: str, fields: list[str])
Retry getting snap information.
- Parameters:
snap_name (str) – The name of the snap.
fields (list[str]) – The fields to include in the response.
- Returns:
The snap information.
- Return type:
- async snap_refresh(snap_name: str, payload: dict, extra_headers: dict = None) Response
Query the Store’s “snap_refresh” endpoint.
Useful for more than refreshing a snap. Notably some snap information is only retrievable from this endpoint. E.g. old revision information
- Parameters:
snap_name (str) – The name of the snap.