尝试使用nexuscli使用python连接到nexus

2024-10-01 04:46:50 发布

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

我正在尝试连接到服务器,执行以下操作:

nexus_config = nexuscli.nexus_config.NexusConfig(username=NEXUS_USER,
                                                 password=NEXUS_PASSWORD,
                                                 url=NEXUS_URL,
                                                 x509_verify=True)
nexus_client = nexuscli.nexus_client.NexusClient(config=nexus_config)
print(nexus_client.repositories.list)

但是,我得到了一个错误:

nexuscli.exception.NexusClientConnectionError: HTTPSConnectionPool(host='my_site.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1091)')))

https://nexus3-cli.readthedocs.io/en/latest/nexuscli.html#module-nexuscli.nexus_config

在请求库中使用API端点检查URL并设置validate=False会得到一个警告,并且确实有效

因此,我将代码更改为:x509_verify=True,希望从请求中得到同样的警告,但我得到的是警告

我有什么遗漏吗?或者图书馆里有个bug? 谢谢各位

nexuscli.exception.NexusClientAPIError: <exception str() failed>

Tags: 服务器clientnexusconfigtrueurl警告exception
1条回答
网友
1楼 · 发布于 2024-10-01 04:46:50

您将获得异常:NexusClientAPIError。根据documents报告:

exception nexuscli.exception.NexusClientAPIError Bases: Exception

Unexpected response from Nexus service.

我认为您的代码很好,x.509证书的问题已经解决,问题可能在服务器端

相关问题 更多 >