cheesechaser.query.gelbooru

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

It includes a class for performing searches based on tags and applying filters to the results. The module utilizes HTTP requests to interact with the Gelbooru API and handles pagination for retrieving multiple pages of results.

GelbooruIdQuery

class cheesechaser.query.gelbooru.GelbooruIdQuery(tags: List[str], filters: List[Callable[[dict], bool]] | None = None, site_url: str = 'https://gelbooru.com')[source]

A class for querying Gelbooru image board and retrieving post information based on tags.

This class extends BaseWebQuery and implements methods for interacting with the Gelbooru API, including session initialization, making API requests, and iterating through search results.

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

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

  • site_url (str) – The base URL of the Gelbooru site, defaults to ‘https://gelbooru.com’.

Variables:
  • tags – The list of tags used for the search.

  • site_url – The base URL of the Gelbooru site.

  • _length – Cached total count of search results.

__init__(tags: List[str], filters: List[Callable[[dict], bool]] | None = None, site_url: str = 'https://gelbooru.com')[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 GelbooruIdQuery instance.

Returns:

A string representation of the object.

Return type:

str