Wiki

Utility functions for dealing with the wiki (https://wiki.auto-pi-lot.com).

See the docstrings of the ask() function, as well as the guide_wiki_plugins section in the user guide for use.

Functions:

ask(filters[, properties])

Perform an API call to the wiki using the ask API and simplify to a list of dictionaries

browse(search[, browse_type, params])

Use the browse api of the wiki to search for specific pages, properties, and so on.

make_ask_string(filters[, properties, full_url])

Create a query string to request semantic information from the Autopilot wiki

make_browse_string(search[, browse_type, ...])

ask(filters: Union[List[str], str], properties: Union[None, List[str], str] = None) List[dict][source]

Perform an API call to the wiki using the ask API and simplify to a list of dictionaries

Parameters
  • filters (list, str) – A list of strings or a single string of semantic mediawiki formatted property filters. See make_ask_string() for more information

  • properties (None, list, str) – Properties to return from filtered pages, See make_ask_string() for more information

Returns:

browse(search: str, browse_type: str = 'page', params: Optional[dict] = None)[source]

Use the browse api of the wiki to search for specific pages, properties, and so on.

Parameters
  • search (str) – the search string! * can be used as a wildcard.

  • browse_type (str) – The kind of browsing we’re doing, one of:

    • page

    • subject

    • property

    • pvalue

    • category

    • concept

  • params (dict) – Additional params for the browse given as a dictionary, see the smw docs for usage.

Returns

dict, list of dicts of results

make_ask_string(filters: Union[List[str], str], properties: Union[None, List[str], str] = None, full_url: bool = True) str[source]

Create a query string to request semantic information from the Autopilot wiki

Parameters
  • filters (list, str) – A list of strings or a single string of semantic mediawiki formatted property filters, eg "[[Category:Hardware]]" or "[[Has Contributor::sneakers-the-rat]]". Refer to the semantic mediawiki documentation for more information on syntax

  • properties (None, list, str) – Properties to return from filtered pages, see the available properties on the wiki and the semantic mediawiki documentation for more information on syntax. If None (default), just return the names of the pages

  • full_url (bool) – If True (default), prepend f'{WIKI_URL}api.php?action=ask&query=' to the returned string to make it ready for an API call

Returns

the formatted query string

Return type

str

make_browse_string(search, browse_type='page', params=None, full_url: bool = True)[source]