reuse.download module

Functions for downloading license files from spdx/license-list-data.

reuse.download.download_license(spdx_identifier: str) str[source]

Download the license text from the SPDX repository.

Parameters:

spdx_identifier – SPDX identifier of the license.

Raises:

URLError – if the license could not be downloaded.

Returns:

The license text.

reuse.download.put_license_in_file(spdx_identifier: str, destination: str | PathLike[str], source: str | PathLike[str] | None = None) None[source]

Download a license and put it in the destination file.

This function exists solely for convenience.

Parameters:
  • spdx_identifier – SPDX License Identifier of the license.

  • destination – Where to put the license.

  • source – Path to file or directory containing the text for LicenseRef licenses.

Raises:
  • URLError – if the license could not be downloaded.

  • FileExistsError – if the license file already exists.

  • FileNotFoundError – if the source could not be found in the directory.