cheesechaser.query.danbooru

This module provides functionality for querying Danbooru image board using its API.

It includes a class DanbooruIdQuery which extends _BaseWebQuery to perform tag-based searches on Danbooru, handling authentication, pagination, and result filtering.

DanbooruIdQuery

class cheesechaser.query.danbooru.DanbooruIdQuery(tags: List[str], filters: List[Callable[[dict], bool]] | None = None, username: str | None = None, api_key: str | None = None, site_url: str | None = 'https://danbooru.donmai.us')[source]

A class for querying Danbooru image board using tags.

This class extends _BaseWebQuery to provide specific functionality for interacting with the Danbooru API. It allows searching for posts using tags, handles authentication, and provides methods for pagination and result filtering.

Parameters:
  • tags (List[str]) – A list of tags to search for on Danbooru.

  • filters (Optional[List[Callable[[dict], bool]]]) – Optional list of filter functions to apply to the query results.

  • username (Optional[str]) – Optional username for Danbooru API authentication.

  • api_key (Optional[str]) – Optional API key for Danbooru API authentication.

  • site_url (Optional[str]) – The base URL of the Danbooru site, defaults to ‘https://danbooru.donmai.us’.

__init__(tags: List[str], filters: List[Callable[[dict], bool]] | None = None, username: str | None = None, api_key: str | None = None, site_url: str | None = 'https://danbooru.donmai.us')[source]

Initialize the _BaseWebQuery object.

Parameters:

filters (Optional[List[_ItemFilterTyping]]) – A list of callable filter functions to apply to query results.

__repr__()[source]

Return a string representation of the DanbooruIdQuery instance.

Returns:

A string representation of the instance.

Return type:

str