警告" InsecurePlatformWarning"用python连接到Rally时(使用pyral)

时间:2015-05-07 10:51:17

标签: python ssl rally pyral

当我通过python REST API(pyral)连接到Rally时,我收到以下警告。

C:\PYTHON27\lib\site-packages\requests-2.6.0-py2.7.egg\requests\packages\urllib3\util\ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning

其余的工作正常但是每次都有这个警告有点烦人。

关于如何解决连接的问题"问题"或隐藏警告?

我使用的代码如下:

#!/usr/bin/env python
from pyral import Rally, rallySettings, RallyRESTAPIError

#####################################
###      CONNECTION TO RALLY      ###
#####################################
#Configuration parameters
my_server = rally1.rallydev.com
my_user = "hello@world.com"
my_password    = "toto"
my_workspace   = "Sandbox"
my_project     = "My Project"
#Connect to Rally
try:
    rally = Rally(my_server, my_user, my_password, workspace=my_workspace, project=my_project)
except RallyRESTAPIError, details:
    sys.stderr.write('ERROR: %s \n\n' % details)
rally.enableLogging('rally.simple-use.log')
print "\n"

1 个答案:

答案 0 :(得分:2)

解决方案一直在我眼前(感谢abarnert!)

只需添加:

import logging
logging.basicConfig(filename='Rally.log',level=logging.NOTSET)
logging.captureWarnings(True)