python - requests/exchangelib SSLError - 主机名“outlook.office.de”不匹配
问题描述
我在连接到Microsoft Exchange
. 它是最近开始的。问题是我不确定在哪里寻找解决方案。
问题是我正在尝试连接,office.de
但证书现在似乎不包含此域。
在哪里寻找解决方案/错误?:
- 我的电脑(Ubuntu 20.04)
- 蟒蛇请求
- 蟒蛇交换库
- 微软证书(临时签发)
追溯:
Traceback (most recent call last):
account = Account(
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/account.py", line 126, in __init__
self.protocol = Protocol(config=config)
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 405, in __call__
raise e
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 400, in __call__
protocol = super().__call__(*args, **kwargs)
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 434, in __init__
self.config.auth_type = self.get_auth_type()
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/protocol.py", line 439, in get_auth_type
auth_type, api_version_hint = get_service_authtype(
File "/home/milano/.virtualenvs/xx-xxx-xxxx/lib/python3.9/site-packages/exchangelib/transport.py", line 155, in get_service_authtype
raise TransportError(str(e)) from e
exchangelib.errors.TransportError: HTTPSConnectionPool(host='outlook.office.de', port=443): Max retries exceeded with url: /EWS/Exchange.asmx (Caused by SSLError(SSLCertVerificationError("hostname 'outlook.office.de' doesn't match either of '*.internal.outlook.com', '*.outlook.com', 'outlook.com', 'office365.com', '*.office365.com', '*.outlook.office365.com', '*.office.com', 'outlook.office.com', 'substrate.office.com', 'attachment.outlook.live.net', 'attachment.outlook.office.net', 'attachment.outlook.officeppe.net', 'attachments.office.net', '*.clo.footprintdns.com', '*.nrb.footprintdns.com', 'ccs.login.microsoftonline.com', 'ccs-sdf.login.microsoftonline.com', 'substrate-sdf.office.com', 'attachments-sdf.office.net', '*.live.com', 'mail.services.live.com', 'hotmail.com', '*.hotmail.com'")))
解决方案
问题是我正在尝试连接到 office.de,但证书现在似乎不包含此域。
这是对的。检查浏览器将表明这不是 Python 的问题,而是该站点是这样设置的,即浏览器也会抱怨。
虽然正式记录在Office 365 Germany 端点上使用,但该域似乎office.de
未设置为与具有此域名的 HTTPS 一起使用。
由于outlook.office.de
目前只是一个别名(DNS CNAME),outlook.office.com
我的猜测是记录的域不是用于通过 HTTPS 直接访问的,而是仅记录它们以获得必要的 IP 范围。在内部,MS Exchange 可能会改用该office.com
域,从而成功匹配证书。
推荐阅读
- java - 如何比较两个 JSON 对象或字符串以获得它们之间的差异报告(JAVA)
- typescript - this.constructor 的多态调用
- java - 带有 Hibernate 的 JBoss EAP 6.4 - 在日志文件中隐藏特定的 Oracle 异常
- java - 从静态 html/css/js Web 应用和 .ear 容器生成 .war 文件
- java - Spring中的默认全局错误
- angularjs - 限制嵌套 ng-repeat 的显示条目
- amazon-web-services - AWS Lambda:调用调用 API 失败并显示消息:[object Object]
- c# - 如何仅在 Visual Studio 中启用当前文件的断点?
- mysql - Windows中的mysql差异/增量备份
- python - Python 通过 1 次调用设置更多属性