python构件库:在存储库上创建文件夹并进行身份验证,无需传递密码

2024-04-25 15:04:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python库与artifactory存储库交互;到目前为止,如果我传递凭证并上传一个文件,那么就很好了。在

path = ArtifactoryPath("http://myartifactory/myrepo/", auth=('tester', 'thepassword'))
path.deploy_file("/tmp/test.zip")

如果我不能上传一个文件夹的话,我就不能上传了。在

IsADirectoryError: [Errno 21] Is a directory

另外,命令path.mkdir()似乎并没有按照它所说的那样做;我确实尝试为文件夹名传递一个字符串,但它不会在atifactory存储库上创建文件夹。在

FileExistsError: [Errno 17] File exists:

我也在寻找一种方法,不硬编码的身份认证,因为这将是不好的共享一个明确的密码。库提到它接受一个证书作为.pem文件,但我不确定如何创建这样的证书。在


Tags: 文件path文件夹authhttpdeploy证书tester
1条回答
网友
1楼 · 发布于 2024-04-25 15:04:05

不能直接上载文件夹,它们必须按the docs保存在存档中:

Supported archive types are: zip; tar; tar.gz; and tgz.

要创建目录,只需传递一个path with the directory you want。在

一个.pem文件用于保存您的RSA公钥,可以通过以下方式生成:

ssh-keygen -f ~/.ssh/id_rsa.pub -m 'PEM' -e > public.pem chmod 600 public.pem

相关问题 更多 >