maven¶
Maven repository utilities.
Module Contents¶
Classes¶
Represent Maven package download link with metadata. |
|
Parser for Maven repository metadata XML to extract package links. |
|
Interface to Maven repository for package discovery and download. |
Attributes¶
- maven.logger¶
- class maven.MavenLink(group: str, name: str, version: str, *, session: requests.Session | None = None)¶
Represent Maven package download link with metadata.
- property sha1_checksum: str | None¶
Retrieve the SHA1 checksum of a package if any.
- Returns:
The SHA1 checksum if possible, otherwise None.
- property md5_checksum: str | None¶
Retrieve the MD5 checksum of a package if any.
- Returns:
The MD5 checksum if possible, otherwise None.
- property pom_sha1_checksum: str | None¶
Retrieve the SHA1 checksum of a package’s POM file if any.
- Returns:
The SHA1 checksum if possible, otherwise None.
- property pom_md5_checksum: str | None¶
Retrieve the MD5 checksum of a package’s POM file if any.
- Returns:
The MD5 checksum if possible, otherwise None.
- BASE_URL = 'https://repo.maven.apache.org/maven2'¶
- _DEFAULT_SESSION¶
- __init_pkg_checksum() None¶
Retrieve package checksums.
This private method is used to initialise lazily the package checksum.
- __init_pom_checksum() None¶
Retrieve POM checksums.
This private method is used to lazily initialise the checksum of the package’s POM file.
- class maven.MavenLinksParser(group: str, name: str, *, session: requests.Session | None = None)¶
Parser for Maven repository metadata XML to extract package links.
- start(tag: str, attrs: dict[str, str | None]) None¶
See XMLParser.start.
- Parameters:
tag – XML tag name
attrs – XML tag attributes
Note
The attrs parameter is not used by this method implementation, but is defined by XMLParser.start method signature.
- data(text: str) None¶
See XMLParser.data.
- Parameters:
text – text data from XML
- 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.
- Parameters:
data – XML data to parse
- class maven.Maven(url: str = MavenLink.BASE_URL)¶
Interface to Maven repository for package discovery and download.
- _DEFAULT_SESSION¶
- 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.
- Parameters:
group – Maven group ID
name – Maven package name
headers – To add additionnal headers to the HTTP request. Can be mandatory depending on the situation.
session – The session object to use to make HTTP requests.
- Returns:
a list of dict containing the link to each resource along with some metadata