reuse.download module - reuse 6.1.2 documentation

Skip to content
Back to top
View this page

# reuse.download module

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

reuse.download.download_license(spdx_identifier: str) → str

  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

  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.