:py:mod:`maven` =============== .. py:module:: maven .. autoapi-nested-parse:: Maven repository utilities. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: maven.MavenLink maven.MavenLinksParser maven.Maven Attributes ~~~~~~~~~~ .. autoapisummary:: maven.logger .. py:data:: logger .. py:class:: MavenLink(group: str, name: str, version: str, *, session: requests.Session | None = None) Represent Maven package download link with metadata. .. py:property:: sha1_checksum :type: str | None Retrieve the SHA1 checksum of a package if any. :return: The SHA1 checksum if possible, otherwise None. .. py:property:: md5_checksum :type: str | None Retrieve the MD5 checksum of a package if any. :return: The MD5 checksum if possible, otherwise None. .. py:property:: pom_sha1_checksum :type: str | None Retrieve the SHA1 checksum of a package's POM file if any. :return: The SHA1 checksum if possible, otherwise None. .. py:property:: pom_md5_checksum :type: str | None Retrieve the MD5 checksum of a package's POM file if any. :return: The MD5 checksum if possible, otherwise None. .. py:attribute:: BASE_URL :value: 'https://repo.maven.apache.org/maven2' .. py:attribute:: _DEFAULT_SESSION .. py:method:: __init_pkg_checksum() -> None Retrieve package checksums. This private method is used to initialise lazily the package checksum. .. py:method:: __init_pom_checksum() -> None Retrieve POM checksums. This private method is used to lazily initialise the checksum of the package's POM file. .. py:class:: MavenLinksParser(group: str, name: str, *, session: requests.Session | None = None) Parser for Maven repository metadata XML to extract package links. .. py:method:: start(tag: str, attrs: dict[str, str | None]) -> None See XMLParser.start. :param tag: XML tag name :param attrs: XML tag attributes .. note:: The `attrs` parameter is not used by this method implementation, but is defined by XMLParser.start method signature. .. py:method:: data(text: str) -> None See XMLParser.data. :param text: text data from XML .. py:method:: feed(data: str) -> MavenLinksParser See HTMLParser.feed. This class doesn't use the HTMLParser, but this method as the exact same function and logic that HTMLParser.feed. :param data: XML data to parse .. py:class:: Maven(url: str = MavenLink.BASE_URL) Interface to Maven repository for package discovery and download. .. py:attribute:: _DEFAULT_SESSION .. py:method:: fetch_project_links(group: str, name: str, *, headers: dict[str, str | bytes | None] | None = None, session: requests.Session | None = None) -> list[MavenLink] Fetch list of resources for a given Maven package. :param group: Maven group ID :param name: Maven package name :param headers: To add additionnal headers to the HTTP request. Can be mandatory depending on the situation. :param session: The session object to use to make HTTP requests. :return: a list of dict containing the link to each resource along with some metadata