【发布时间】:2023-03-31 18:58:02
【问题描述】:
几个月来,我一直在使用ews-orgmode / ews-fetch-calendar.py Python 脚本下载我的 Office365/Outlook/Exchange 工作日历,没有任何问题。然而,上周我重新安排了我的 Linux 系统上的 Python 环境(通过系统包管理器安装更少的包,通过 pip 安装更多包)。这停止了我的日历下载工作,因为我还卸载了 pycurl(以及我必须使用 pip 重新安装的一些其他包,以使其他一些脚本再次运行)。
但是,同样在重新安装 pycurl 之后,我无法让脚本继续工作。脚本和配置/设置文件没有改变,所以要么我的 Python 环境有问题,要么在 2019 年 10 月 29 日到 2019 年 11 月 6 日之间,服务器 API 发生了一些事情。我一直在我的系统和专用虚拟环境中正常尝试此操作(仅安装必要的软件包),但无济于事,我不知道下一步该做什么,因此我在这里发帖。
脚本是用 Python2 编写的,我的 Gentoo Linux 系统上安装了 Python2.7。该问题似乎是 Outlook/EWS 服务器报告的一个错误,导致空响应最终破坏了代码。我强烈怀疑问题出在 pycurl/服务器交互中,但我没有足够的知识来找出确切的问题。欢迎任何提示(或解决方案):-)
Settings:
ewsHost outlook.office365.com/
ewsUrl EWS/Exchange.asmx
ewsUser xxx@xxx.xx
ewsPassword xxxxxxxxxxxx
ewsAuthType basic
ewsCAInfo
timezoneLocation xxx/xxx
daysHistory 30
daysFuture 90
maxEntries 300
Debug output pycurl:
* Trying 40.101.18.242:443...
* TCP_NODELAY set
* Connected to outlook.office365.com (40.101.18.242) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; CN=outlook.com
* start date: Nov 17 00:00:00 2018 GMT
* expire date: Nov 17 12:00:00 2020 GMT
* subjectAltName: host "outlook.office365.com" matched cert's "*.office365.com"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert Cloud Services CA-1
* SSL certificate verify ok.
* Server auth using Basic with user 'xxx@xxx.xx'
> POST /EWS/Exchange.asmx HTTP/1.1
Host: outlook.office365.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxx
User-Agent: PycURL/7.43.0.3 libcurl/7.66.0 OpenSSL/1.1.1d zlib/1.2.11 libssh2/1.9.0
Accept: */*
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8
Content-Length: 912
Expect: 100-continue
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Server: Microsoft-IIS/10.0
< request-id: ec37d426-3b42-4c40-9136-9f085e39e833
< X-CalculatedFETarget: VI1PR09CU002.internal.outlook.com
< X-ProxyErrorLabel: ProxyHandler::ExecuteRequestHandler/ProxyHandler::SubmitBackEndRequest
< X-ProxyErrorHResult: 0x80070057
< X-ProxyErrorMessage: The parameter is incorrect.
< X-Proxy-RoutingCorrectness: 1
< X-Powered-By: ASP.NET
< X-FEServer: AM4PR0501CA0059
< Date: Thu, 07 Nov 2019 10:37:51 GMT
< Content-Length: 0
* HTTP error before end of send, stop sending
<
* Closing connection 0
Traceback (most recent call last):
File "./ews-fetch-calendar.py", line 204, in <module>
root = etree.fromstring(data)
File "src/lxml/etree.pyx", line 3234, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1764, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
File "<string>", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
【问题讨论】:
标签: python outlook office365 exchangewebservices pycurl