:py:mod:`npm` ============= .. py:module:: npm .. autoapi-nested-parse:: NPM package management. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 link/index.rst parser/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: npm.NPMLinksParser npm.NPM Attributes ~~~~~~~~~~ .. autoapisummary:: npm.logger .. py:class:: NPMLinksParser Parser for NPM registry JSON responses to extract package links. .. py:method:: _raise_missing_key(key: str) -> NoReturn Raise a missing key error. :param key: The missing key. :raises KeyError: Always. .. py:method:: feed(data: str) -> NPMLinksParser Feed this parser with retrieved JSON data. :param data: JSON data to parse .. seealso:: :py:meth:`html.parser.HTMLParser.feed` .. py:data:: logger .. py:class:: NPM(url: str = 'https://registry.npmjs.org/') Interface to NPM registry for package discovery and download. .. py:method:: fetch_project_links(name: str, *, headers: dict[str, str | bytes | None] | None = None, session: requests_cache.CachedSession | requests.Session | None = None) -> list[link.NPMLink] Fetch list of resources for a given NPM package. :param name: NPM package name :param headers: To add additionnal headers to the HTTP request. Can be mandatory depending on the situation. :param session: An optional user session to use. If None, a requests.Session is used. :return: a list of dict containing the link to each resource along with some metadata