The uploaded custom collector package can be downloaded from the HDFS using below API.
GET: {{TCO_URL}}/dcc/v1/packages/<package_name>/download
Use below curl command to download the uploaded custom collector package.
curl -X GET ":/dcc/v1/packages/{package_name}/download" -u 'user:password'
@custom_collector_v1.route('/packages/<package_name>/download', methods=['GET']) def download_custom_collector_package(package_name): """ Download the uploaded Collector Package via name attribute. Returns: Custom Collector Object uploaded in the HDFS """ try: current_app.logger.info("download custom collector package") if not bool(check_custom_collector_exist(package_name)): raise Exception("Custom Collector Package not found.") with tempfile.TemporaryDirectory() as zippedDir: with tempfile.NamedTemporaryFile(delete=False, dir=zippedDir) as tmp: current_app.logger.debug("tmp file name " + tmp.name) filename = download_file_from_hdfs(package_name, tmp.name) if filename is None: raise FileNotFoundError("package file is not present wrt " + package_name) archive_temp_file = shutil.make_archive(tmp.name, "zip", root_dir=tmp.name) current_app.logger.debug("archive_temp_file " + archive_temp_file) tmp_dir, tmp_filename = archive_temp_file.rsplit(os.sep, 1) return send_from_directory(tmp_dir, tmp_filename, as_attachment=True) except Exception as e: resp = jsonify({"Error": str(e)}) resp.status_code = 500 current_app.logger.error(e) current_app.logger.error(traceback.format_exc()) return resp