简体   繁体   中英

Softlayer Python API TransportError SSL CERTIFICATE_VERIFY_FAILED (_SSL.C:590)

What used to be working python code to make API calls from SoftLayer, now gives errors.

import SoftLayer

conn = SoftLayer.create_client_from_env(username='',api_key='')

allParents = conn.call('Account','getAllTopLevelBillingItems')

allParents[0] # returns the first billing_Item as a dict

It used to work, but now the following error messages appear:

result = conn['SoftLayer_Account'].getAllTopLevelBillingItems(mask=objectMask)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 363, in call_handler
    return self(name, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 331, in call
    return self.client.call(self.name, name, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/SoftLayer/API.py", line 227, in call
    return self.transport(request)
  File "/usr/local/lib/python2.7/dist-packages/SoftLayer/transports.py", line 164, in __call__
    raise exceptions.TransportError(0, str(ex))
SoftLayer.exceptions.TransportError: TransportError(0): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

This may be related with this one SSL InsecurePlatform error when using Requests package

Softlayer has documented this about SSL errors:

On Python versions below Python 2.7.9, requests has started emitting a security warning (InsecurePlatformWarning) due to insecurities with creating SSL connections. To resolve this, upgrade to Python 2.7.9+ or follow the instructions here: https://stackoverflow.com/a/29099439 .

please make sure you are using Python 2.7.9 or supirior and try again

I found a couple of months ago that if the python certifi package was installed, this would cause SoftLayer API traffic to fail certificate validation.

I never found out why, I just avoided the packages that created that dependency. In my case, I was trying to install flower.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM