Skip to content

search()/search_v2() do not support the API's limit parameter #444

Description

@Vitexus

The /api/v2/search endpoint (and /api/v1/search) accepts a limit query parameter (e.g. GET /api/v2/search?q=aptly&type=statuses&limit=40), but Mastodon.search() / Mastodon.search_v2() / Mastodon.search_v1() do not expose it:

>>> from mastodon import Mastodon
>>> import inspect
>>> inspect.signature(Mastodon.search)
(self, q: str, resolve: bool = True, result_type: Optional[str] = None, account_id=None, offset: Optional[int] = None, min_id=None, max_id=None, exclude_unreviewed: bool = True) -> Union[Search, SearchV2]

Calling with limit= raises:

>>> Mastodon.search(None, q='test', limit=5)
TypeError: search() got an unexpected keyword argument 'limit'

Mastodon.py version: 2.2.1

Could limit be added as a passthrough parameter to search()/search_v1()/search_v2(), similar to how it's supported on other list-returning endpoints (e.g. account_search)? Currently the only workaround is to over-fetch and truncate client-side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions