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_sizeBattle.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
Nonefor no lower bound.max – The upper bound, or
Nonefor no upper bound.inclusive – Whether the bounds themselves match.
- min: int | None = None#
- max: int | None = None#
- inclusive: bool = True#
- 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
RangeandNot.- Type:
A filter value
- wow.search.encode_search(filters: collections.abc.Mapping[str, FilterValue] | None, *, order_by: str | collections.abc.Sequence[str] | None, page: int, page_size: int) dict[str, str | int][source]#
Turn search arguments into query parameters.
- Raises:
ValueError –
pageorpage_sizeis out of range, or a sequence filter is empty.