title: Python 2.7 [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)>
body: <p>I am porting a django project over from RHEL5 to RHEL7 and python 2.5 to 2.7.5 and am having certificate problems. The bit of code I am troubleshooting is a suds Client invocation of a web service WSDL <code>client = Client(_LDAP_URLS[env])</code> where LDAP_URLS is already defined in the code. I imported it using <code>from suds.client import Client</code></p>
  
  <p>I think this may be more of a Linux and Python interaction problem between the two versions rather than an issue with the code, but I could be wrong. Here is the full code. (this is django by the way, so this is a view.py file)</p>
  
  <pre><code>from django.conf import settings
  from django.core.urlresolvers import reverse
  from django.http import HttpResponseRedirect, HttpResponse
  from django.shortcuts import render_to_response
  
  from suds.client import Client
  from suds.wsse import Security
  import suds
  from gaic.security.sso import BinarySecurityToken
  from ud_data_extract import UDDataExtractForm
  
  
  
  _LDAP_URLS = {WSDL URLS HARD CODED HERE}
  
  def _get_person(env='production', hid=None, vid=None, token=None, group=None):
      if env not in _LDAP_URLS:
          env = 'production'
      if token:
          client = Client(_SSO_URLS[env])
          try:
              person = client.service.getPersonFromToken(token)
              hid = person['hid']
          except Exception:
              return None
      try:
          client = Client(_LDAP_URLS[env])
      except Exception as e:
          log.error("line 165: %s", e)
  
      if group:
          grp = client.factory.create('groupDto')
          grp.name = group
          users = client.service.getGroupMembers(grp)
          groups = []
          try:
              group_ = client.service.getGroup(grp)
              gnamere = re.compile(r'cn=([^,]+),')
              for gname in group_.uniqueMembers:
                  m = gnamere.match(gname)
                  if m:
                      group_name = m.groups(1)[0]
                      groups.append(group_name)
              groups.sort()
          except Exception, e:
              pass  # groups = [str(e)]
          return [users, groups]
      person = client.factory.create('personDto')
      if hid:
          person.hid = hid
      if vid:
          person.vid = vid
      user = None    
  </code></pre>
  
  <p>The issue in my logging points to around line 165, I took out some code with our company wsdl urls so it may be in the 150s. It's in a try statement.</p>
  
  <pre><code>try:
              client = Client(_LDAP_URLS[env])
          except Exception as e:
              log.error("line 165: %s", e)
  </code></pre>
  
  <p>I have looked around and <a href="https://community.hortonworks.com/questions/120861/ambari-agent-ssl-certificate-verify-failed-certifi.html" rel="nofollow noreferrer">this page</a> said that it may be a problem with newer version of python and pointed to <a href="https://access.redhat.com/articles/2039753#controlling-certificate-verification-7" rel="nofollow noreferrer">this redhat documentation</a> to fix it, but I really don't know what to do with it.</p>
  
  <p>Thanks in advance for the help.</p>