我已经使用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 [email protected]
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 '[email protected]'
> 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
我再也没有让ews-orgmode
工作,我也从不明白为什么。
同时,我已经开始使用Exchangelib,现在我将其用于将Office365日历同步到我的本地Orgmode议程(单向流量),这受this answer的启发。