search#

Filters for Battle.net search endpoints.

Search methods take filters, a mapping from a document field to a value:

client.items.search(
    filters={
        "item_class.id": 2,  # equals
        "quality.type": ["EPIC", "LEGENDARY"],  # any of
        "required_level": Range(50, 60),  # 50 <= level <= 60
        "inventory_type.type": Not("SHIELD"),  # not equal
    },
    order_by=["level:desc", "id"],
)

Field names follow the search document, with dots for nesting. Localized fields take a locale suffix, as in name.en_US.

wow.search.MAX_PAGE_SIZE: Final = 1000#

The largest page_size Battle.net accepts, and also the most results one query returns.

class wow.search.Range[source]#

Match a numeric field between two bounds; leave one out for an open range.

Variables:
  • min – The lower bound, or None for no lower bound.

  • max – The upper bound, or None for no upper bound.

  • inclusive – Whether the bounds themselves match.

min: int | None = None#
max: int | None = None#
inclusive: bool = True#
encode() → str[source]#

Render Blizzard’s range syntax, such as [50,60] or (,77).

class wow.search.Not[source]#

Match documents whose field is not this value.

Variables:

value – The value to exclude.

value: Scalar#
type wow.search.FilterValue = Scalar | bool | Range | Not | Sequence[Scalar]#

equals for a scalar, any-of for a sequence, plus Range and Not.

Type:

A filter value

Turn search arguments into query parameters.

Raises:

ValueError – page or page_size is out of range, or a sequence filter is empty.