Allow suppressing of SSL log warnings
Currently there is no way to suppress this warning, making the log file bogged down with these messages. There should be an override flag that allows you to willingly disabled these log messages. Change-Id: Ie8a65feb2e9c3cfb666861157e2236e90e25ee29
This commit is contained in:
parent
b6e4689754
commit
970b2bf6a4
|
@ -4,7 +4,8 @@
|
|||
.. automodule:: hpelefthandclient.http
|
||||
:synopsis: HTTP REST Base Class
|
||||
|
||||
.. autoclass:: hpelefthandclient.http.HTTPJSONRESTClient(api_url, [secure=True[,http_log_debug=False]])
|
||||
.. autoclass:: hpelefthandclient.http.HTTPJSONRESTClient(api_url, secure=True, http_log_debug=False,
|
||||
suppress_ssl_warnings=False)
|
||||
|
||||
.. automethod:: authenticate
|
||||
.. automethod:: unauthenticate
|
||||
|
|
|
@ -87,3 +87,8 @@ Changes in Version 2.0.0
|
|||
* Rebranded the HPLeftHandClient to HPELeftHandClient.
|
||||
* Updating the documentation to use the new PyPi project name for the
|
||||
client, 'python-lefthandclient'.
|
||||
|
||||
Changes in Version 2.0.1
|
||||
------------------------
|
||||
|
||||
* Allows suppressing of InsecureRequestWarning messages
|
||||
|
|
|
@ -34,12 +34,12 @@ Doing so is easy:
|
|||
# SSL certification verification is defaulted to False. In order to
|
||||
# override this, set secure=True. or secure='/path/to/cert.crt'
|
||||
# cl = client.HPELeftHandClient("https://10.10.10.10:8081/lhos",
|
||||
# secure=True)
|
||||
# secure=True)
|
||||
# Or, to use ca certificates as documented by Python Requests,
|
||||
# pass in the ca-certificates.crt file
|
||||
# http://docs.python-requests.org/en/v1.0.4/user/advanced
|
||||
# cl = client.HPELeftHandClient("https://10.10.10.10:8081/lhos",
|
||||
# secure='/etc/ssl/certs/ca-certificates.crt')
|
||||
# secure='/etc/ssl/certs/ca-certificates.crt')
|
||||
|
||||
try:
|
||||
cl.login(username, password)
|
||||
|
|
|
@ -24,7 +24,7 @@ HPE LeftHand REST Client
|
|||
|
||||
"""
|
||||
|
||||
version_tuple = (2, 0, 0)
|
||||
version_tuple = (2, 0, 1)
|
||||
|
||||
|
||||
def get_version_string():
|
||||
|
|
|
@ -50,6 +50,9 @@ class HTTPJSONRESTClient(object):
|
|||
:type secure: bool
|
||||
:param http_log_debug: Turns on http log debugging. Default will not log
|
||||
:type http_log_debug: bool
|
||||
:param suppress_ssl_warnings: Suppresses log warning messages if True.
|
||||
Default will not suppress warnings.
|
||||
:type suppress_ssl_warnings: bool
|
||||
|
||||
"""
|
||||
|
||||
|
@ -60,7 +63,10 @@ class HTTPJSONRESTClient(object):
|
|||
http_log_debug = False
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
def __init__(self, api_url, secure=False, http_log_debug=False):
|
||||
def __init__(self, api_url, secure=False, http_log_debug=False,
|
||||
suppress_ssl_warnings=False):
|
||||
if suppress_ssl_warnings:
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
self.session_key = None
|
||||
|
||||
#should be http://<Server:Port>/lhos
|
||||
|
|
Loading…
Reference in New Issue