foss_cli: Not able to upload a file (error:fossology.exceptions.FossologyApiError: Upload upload via foss-cli could not be performed: Require uploadType (400))
Hi,
I installed fossology 3.2.0 and used the foss_cli. The fossology server is spinned up using docker and available and running at http://localhost:8081/repo These are the commands followed:
foss_cli configfoss_cli -vv create_group FossGroupfoss_cli -vv create_folder FossFolder --folder_group FossGroup --folder_description "Description of FossFolder"foss_cli -vv upload_file --folder_name FossFolder --access_level public /mnt/c/Users/xxx/Downloads/xxx.tar.gz
Step1 to 3 works, but for Step4, this is the output I get,
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:305] - foss_cli called with: ['/home/xxxx/env_fossology/bin/foss_cli',
'-vv',
'upload_file',
'--folder_name',
'FossFolder',
'--access_level',
'public',
'/mnt/c/Users/xxxx/Downloads/xxxx.tar.gz']
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:146] - Function needs_later_initialization_of_foss_instance called {'DEBUG': False,
'IS_REQUEST_FOR_CONFIG': False,
'IS_REQUEST_FOR_HELP': False,
'RESULT_DIR': '.foss_cli_results',
'TOKEN': None,
'VERBOSE': 2}
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:309] - Initializing Fossology client according to the CLI context
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:198] - INIT FOSS
2024-04-30 11:20:23,035 - DEBUG - [foss_cli.py:207] - Set server token from configfile http://localhost:8081/repo:xxxx
2024-04-30 11:20:23,179 - DEBUG - [foss_cli.py:224] - Logged in as user fossy
2024-04-30 11:20:23,184 - DEBUG - [foss_cli.py:555] - Try to upload file /mnt/c/Users/xxxx/Downloads/xxxx.tar.gz
2024-04-30 11:20:23,184 - DEBUG - [foss_cli.py:94] - Found upload folder FossFolder with id 3
Traceback (most recent call last):
File "/home/xxxx/env_fossology/bin/foss_cli", line 8, in
I also tried different other type of files (*.zip, *.txt) to upload, but could not do it successfully. However, uploading manually is successfull. Can you let me know what is wrong.
Thanks and regards, Irin
Dear @IrinSamuel,
thanks for the very precise bug report. This error has been fixed in version 3.2.1: https://github.com/fossology/fossology-python/releases/tag/v3.2.1.
Can you give it a try?
Hi @deveaud-m
Thanks for your answer. I tried now with the latest v3.2.1 and it works. However, this release is not available with pip install https://pypi.org/project/fossology/
The latest there is still 3.2.0. Can you please add this release there as well so that I can use it with pip and not do a manual install?
Thanks and regards, Irin
@deveaud-m any updates on this one? Can you publish 3.2.1 to pypi.org
@IrinSamuel sorry for the long delay, I missed your comment, I just published the package on PyPi: https://pypi.org/project/fossology/3.2.1/