我需要上传一些zip文件到存储库,我们使用的是原始文件,因为它们只是我们稍后将下载的文件,并且我们只保留它们用于版本控制
所以我有一个本地的压缩文件和一个仓库,我如何使用API上传它,我需要首先在仓库中创建一个文件夹吗?或者,当我上传文件时,我可以指定路径,API将在Nexus中创建文件夹结构,并将zip文件放在那里?
我试着去理解,但是显示了maven和其他软件的
https://help.sonatype.com/repomanager3/rest-and-integration-api/assets-api
谢谢你们。
发布于 2020-10-27 05:49:49
我找不到一个好的方法来看如何传递参数,所以我用https://my_site.net/swagger-ui/#/components/uploadComponent接口做了,然后我把卷曲复制到https://curl.trillworks.com/#python,删除了不需要的东西,我最终得到了,希望对将来的某个人有用。
import requests
files = {
'raw.directory': (None, 'testing/testing2'), # folder structure you want in nexus
'raw.asset1': (open('path/to/your/file.zip', 'rb')),
'raw.asset1.filename': (None, 'desire_name.zip'), # this is the name you want to see in nexus
}
response = requests.post('https://my_site/service/rest/v1/components?repository={repo_name}'.format(repo_name="your_repo"), files=files, auth=(NEXUS_USER, NEXUS_PASSWORD), verify=False)https://stackoverflow.com/questions/64542993
复制相似问题