Fossology Items¶
Methods used to access “items/” endpoints.
- class fossology.items.Items¶
Class dedicated to all “uploads…items” related endpoints
- get_bulk_history(upload: Upload, item_id: int) list[GetBulkHistory] ¶
Get the bulk history for a specific upload item
API Endpoint: GET /uploads/{id}/item/{itemId}/bulk-history
- Parameters:
upload (Upload) – the upload to get items from
item_id (int) – the id of the item with clearing decision
- Returns:
list of data from the bulk history
- Return type:
List[GetBulkHistory]
- Raises:
FossologyApiError – if the REST call failed
AuthorizationError – if the REST call is not authorized
- get_clearing_history(upload: Upload, item_id: int) list[GetClearingHistory] ¶
Get the clearing history for a specific upload item
API Endpoint: GET /uploads/{id}/item/{itemId}/clearing-history
- Parameters:
upload (Upload) – the upload to get items from
item_id (int,) – the id of the item with clearing decision
- Returns:
the clearing history for the specified item
- Return type:
List[GetClearingHistory]
- Raises:
FossologyApiError – if the REST call failed
AuthorizationError – if the REST call is not authorized
- get_prev_next(upload: Upload, item_id: int, selection: PrevNextSelection | None = None) GetPrevNextItem ¶
Get the index of the previous and the next time for an upload
API Endpoint: GET /uploads/{id}/item/{itemId}/prev-next
- Parameters:
upload (Upload) – the upload to get items from
item_id (int) – the id of the item with clearing decision
selection (str) – tell Fossology server how to select prev-next item
- Returns:
list of items for the clearing history
- Return type:
List[GetPrevNextItem]
- Raises:
FossologyApiError – if the REST call failed
AuthorizationError – if the REST call is not authorized
- item_copyrights(upload: Upload, item_id: int, status: CopyrightStatus) int ¶
Get the total copyrights of the mentioned upload tree ID
API Endpoint: GET /uploads/{id}/item/{itemId}/totalcopyrights
- Parameters:
upload (Upload) – the upload to get items from
item_id (int,) – the id of the item
status – the status of the copyrights
- Returns:
the total number of copyrights for the uploadtree item
- Return type:
int
- Raises:
FossologyApiError – if the REST call failed
- item_info(upload: Upload, item_id: int) FileInfo ¶
Get the info for a specific upload item
API Endpoint: GET /uploads/{id}/item/{itemId}/info
- Parameters:
upload (Upload) – the upload to get items from
item_id (int,) – the id of the item
- Returns:
the file info for the specified item
- Return type:
- Raises:
FossologyApiError – if the REST call failed
- schedule_bulk_scan(upload: Upload, item_id: int, spec: dict)¶
Schedule a bulk scan for a specific upload item
API Endpoint: POST /uploads/{id}/item/{itemId}/bulk-scan
Bulk scan specifications spec are added to the request body, following options are available:
>>> bulk_scan_spec = { ... "bulkActions": [ ... { ... "licenseShortName": 'MIT', ... "licenseText": 'License text', ... "acknowledgement": 'Acknowledgment text', ... "comment": 'Comment text', ... "licenseAction": 'ADD', # or 'REMOVE' ... } ... ], ... "refText": 'Reference Text', ... "bulkScope": 'folder', # or upload ... "forceDecision": 'false', ... "ignoreIrre": 'false', ... "delimiters": 'DEFAULT', ... "scanOnlyFindings": 'true', ... }
- Parameters:
upload (Upload) – the upload for the bulk scan
item_id (int) – the id of the item for the bulk scan
spec – bulk scan specification
- Raises:
FossologyApiError – if the REST call failed
AuthorizationError – if the REST call is not authorized