使用CmisClient库连接到安全网站

时间:2015-05-22 10:32:36

标签: python ssl https cmis

在我的项目中,我们尝试使用CMIS获取文件夹存储库,并使用python脚本对其进行测试;下面是我使用的代码

from cmislib.model import CmisClient
client = CmisClient('http://localhost/CMIS/Service/servicedoc', 's', 's')
repo = client.defaultRepository
info = repo.info
for k,v in info.items():
    print "%s:%s" % (k,v)

somefld = repo.getObject('idf_96_Z2CMIS')      
props = somefld.properties
for k,v in props.items():
    print "%s:%s" % (k,v)

此代码完美无缺。但是现在服务启用了SSL(https // localhost / CMIS / Service / servicedoc),当我更改CmisClient中的URL时,它会抛出以下错误

c:\Python27>python.exe cmis.py
CMIS client connection to https://localhost/Cmis/Service/servicedoc
Traceback (most recent call last):
  File "cmis.py", line 4, in <module>
    repo = client.defaultRepository
  File "c:\Python27\lib\site-packages\cmislib-0.5.1-py2.7.egg\cmislib\model.py",
 line 179, in getDefaultRepository
  File "c:\Python27\lib\site-packages\cmislib-0.5.1-py2.7.egg\cmislib\model.py",
 line 206, in get
  File "c:\Python27\lib\site-packages\cmislib-0.5.1-py2.7.egg\cmislib\net.py", l
ine 145, in get
  File "c:\Python27\lib\urllib2.py", line 404, in open
    response = self._open(req, data)
  File "c:\Python27\lib\urllib2.py", line 422, in _open
    '_open', req)
  File "c:\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "c:\Python27\lib\urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "c:\Python27\lib\urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>

如何使用CMISClient库连接到启用SSL的网站。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我将网址更改为&lt;&gt;而不是localhost https://&lt;&gt; / Cmis / Service / servicedoc,它起作用了。