' [ssl:cielder_verify_failed]证书验证失败:无法获取本地发行者证书(_SSL.C:997))')))))))

发布于 2025-02-02 13:18:47 字数 1166 浏览 2 评论 0原文

使用此代码时,会生成以下错误:

fressangelib.errors.transporterror:httpsconnectionpool(host ='mail.rt.yu',端口= 443):最大恢复 超过url:/ews/exchange.asmx(由sslerror引起(sslcertverificationerror引起(1,'[ssl:cetiral_verify_failed]证书验证验证失败:无法获得本地发行者证书(_sssl.c:997)')))

> p>> p>>

>

超过url:/ews/exchange.asmx(由sslerror引起(sslcertverificationerror引起(1,'[ssl : 本地发行人证书还是以其他方式解决了问题?

from exchangelib import Credentials,DELEGATE, IMPERSONATION, Account,Message, Mailbox, FileAttachment,Configuration

credentials = Credentials(username=r'sinai\afgggn.t.auu',
                             password='SSft@y155')
config = Configuration(server='mail.te.eg', credentials=credentials)
account = Account(primary_smtp_address='afgggn.t.auu', config=config,
                  autodiscover=False, access_type=DELEGATE)
for item in account.inbox.all().order_by('-datetime_received')[:100]:
    print(item.subject, item.sender, item.datetime_received)

更新 这是在搜索解决方案的麻烦之后解决问题的解决方案 将域验证证书下载为 *.crt或 *PEM文件 打开编辑器中的文件,然后将其内容复制到剪贴板 查找您的cacert.pem位置:从请求。打印(default_ca_bundle_path) 编辑cacert.pem文件,并在文件末尾粘贴域验证证书。 保存文件并享受请求!

When using this code, the following error is generated:

exchangelib.errors.TransportError: HTTPSConnectionPool(host='mail.rt.yu', port=443): Max retries
exceeded with url: /EWS/Exchange.asmx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

How can I provide a local issuer certificate or otherwise solve the problem?

from exchangelib import Credentials,DELEGATE, IMPERSONATION, Account,Message, Mailbox, FileAttachment,Configuration

credentials = Credentials(username=r'sinai\afgggn.t.auu',
                             password='SSft@y155')
config = Configuration(server='mail.te.eg', credentials=credentials)
account = Account(primary_smtp_address='afgggn.t.auu', config=config,
                  autodiscover=False, access_type=DELEGATE)
for item in account.inbox.all().order_by('-datetime_received')[:100]:
    print(item.subject, item.sender, item.datetime_received)

update
This is the solution to the problem after the trouble of searching for solutions
download the domain validation certificate as *.crt or *pem file
open the file in editor and copy it's content to clipboard
find your cacert.pem location: from requests.utils import DEFAULT_CA_BUNDLE_PATH; print(DEFAULT_CA_BUNDLE_PATH)
edit the cacert.pem file and paste your domain validation certificate at the end of the file.
Save the file and enjoy requests!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

箜明 2025-02-09 13:18:47

Exchangelib使用请求来执行实际的HTTP请求。这意味着您可以设置requests_ca_bundle环境变量。请参阅 Ubuntu系统

exchangelib uses requests to do the actual HTTP requests. This means you can set the REQUESTS_CA_BUNDLE environment variable. See How to force requests use the certificates on my ubuntu system

梦年海沫深 2025-02-09 13:18:47

我在Ubuntu 22.04上遇到了同样的问题。就我而言,我的/etc/ssl/certs/ca-certificates.crt无效。我制作了它的副本,并用 https://curl.haxx.se/ca/ca/ cacert.pem 。这解决了错误。

I got the same issue on Ubuntu 22.04. And in my case my /etc/ssl/certs/ca-certificates.crt was not valid. I made a copy of it and replaced it with https://curl.haxx.se/ca/cacert.pem. This resolved the error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文