Public API

Search the Python documentation from your terminal.

Data:

cache_dir

Directory in which cached files are stored.

Functions:

cache_dir_for_url(url)

Returns the path to the cache subdirectory for the given URL.

download_objects_inv(docs_url)

Download the Sphinx objects.inv file for the documentation available at the given URL.

find_url(docs_url, search_term)

Find the complete documentation URL for the given function, class, method etc.

resolve_url(url)

Resolve any redirects in the given URL.

cache_dir = PosixPathPlus('/home/docs/.cache/searchdocs')

Type:    PosixPathPlus

Directory in which cached files are stored.

cache_dir_for_url(url)[source]

Returns the path to the cache subdirectory for the given URL.

Parameters

url (Union[str, URL])

Return type

PathPlus

download_objects_inv(docs_url)[source]

Download the Sphinx objects.inv file for the documentation available at the given URL.

Parameters

docs_url (Union[str, RequestsURL]) – The base URL for the documentation, e.g. "https://docs.python.org/3/".

Return type

PathPlus

Returns

The filename of the cached file.

find_url(docs_url, search_term)[source]

Find the complete documentation URL for the given function, class, method etc.

Parameters
  • docs_url (Union[str, RequestsURL]) – The base URL for the documentation, e.g. "https://docs.python.org/3/".

  • search_term (str) – The object to search for, e.g. 'TemporaryDirectory'.

Return type

URL

Returns

The url of the object in the documentation, e.g. URL('https://docs.python.org/3/'library/tempfile.html#tempfile.TemporaryDirectory').

resolve_url(url)[source]

Resolve any redirects in the given URL.

Parameters

url (Union[str, RequestsURL])

Return type

RequestsURL