Fossology Report

Methods used to access “report/” endpoints.

class fossology.report.Report

Class dedicated to all “report” related endpoints

download_report(report_id: int, group: str = None) → Tuple[str, str]

Download a report

API Endpoint: GET /report/{id}

Example

>>> from fossology.api import Fossology
>>>
>>> foss = Fossology(FOSS_URL, FOSS_TOKEN, username)
>>>
>>> # Generate a report for upload 1
>>> report_id = foss.generate_report(foss.detail_upload(1))
>>> report_content, report_name = foss.download_report(report_id)
>>> with open(report_name, "wb") as report_file:
>>>     report_file.write(report_content)
Parameters
  • report_id (int) – the id of the generated report

  • group (string) – the group name to choose while downloading a specific report (default: None)

Returns

the report content and the report name

Return type

Tuple[str, str]

Raises
generate_report(upload: fossology.obj.Upload, report_format: fossology.obj.ReportFormat = None, group: str = None)

Generate a report for a given upload

API Endpoint: GET /report

Parameters
  • upload (Upload) – the upload which report will be generated

  • format (ReportFormat) – the report format (default: ReportFormat.READMEOSS)

  • group (string) – the group name to choose while generating the report (default: None)

Returns

the report id

Return type

int

Raises