title: Google Drive API ExtensionNotFound Error (Python)
body: <p>I am trying to use the Google Drive and Google Sheets APIs with Python to access a test Google Sheet that I set up. Just following a tutorial online, when I run the code I get the following error:</p>
  
  <pre><code>  File "C:\...\Roaming\Python\Python37\site-packages\cryptography\x509\extensions.py", line 131, in get_extension_for_class
      "No {} extension was found".format(extclass), extclass.oid
  
  ExtensionNotFound: No &lt;class 'cryptography.x509.extensions.SubjectAlternativeName'&gt; extension was found
  </code></pre>
  
  <p>Suffice it to say, I'm pretty confused.</p>
  
  <p><strong>Project Code:</strong></p>
  
  <pre><code>#import library
  import gspread
  
  #Service client credential from oauth2client
  from oauth2client.service_account import ServiceAccountCredentials
  
  #Create scope
  scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
  
  #create some credential using that scope and content of startup_funding.json
  creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json',scope)
  #create gspread authorize using that credential
  client = gspread.authorize(creds)
  
  wks = client.open('api_tester').sheet1
  </code></pre>
  
  <p><strong>What I've tried so far:</strong></p>
  
  <ul>
  <li>Using pip to install the cryptography package, but it says everything is there</li>
  <li>Removing the <code>.sheet1</code>, which gets rid of the error but obviously doesn't help me achieve my goal</li>
  </ul>
  
  <p>Is there something in that <code>.sheet1</code> method that's causing this, perhaps?</p>
  
  <p>I'm using Python 3.7, I have the correct Sheet title and, as far as I can tell, all of the right permissions on my API credentials (I've also given Sheet edit access to the client_email in the JSON file). </p>
  
  <p>I've never seen an error like this before and would really appreciate any help you can provide!</p>
  
  <p>Edit:
  <strong>Here is the full traceback:</strong></p>
  
  <pre><code>Traceback (most recent call last):
  
    File "&lt;ipython-input-48-6114487ac5ae&gt;", line 1, in &lt;module&gt;
      runfile('C:/Users/parke/OneDrive/Documents/Random Projects/API injector.py', wdir='C:/Users/parke/OneDrive/Documents/Random Projects')
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
      execfile(filename, namespace)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
      exec(compile(f.read(), filename, 'exec'), namespace)
  
    File "C:/Users/parke/OneDrive/Documents/Random Projects/API injector.py", line 13, in &lt;module&gt;
      wks = client.open('api_tester').sheet1
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\gspread\client.py", line 123, in open
      self.list_spreadsheet_files()
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\gspread\client.py", line 96, in list_spreadsheet_files
      res = self.request('get', url, params=params).json()
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\gspread\client.py", line 73, in request
      headers=headers
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 546, in get
      return self.request('GET', url, **kwargs)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
      resp = self.send(prep, **send_kwargs)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
      r = adapter.send(request, **kwargs)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 449, in send
      timeout=timeout
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
      chunked=chunked)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request
      self._validate_conn(conn)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 839, in _validate_conn
      conn.connect()
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 355, in connect
      cert = self.sock.getpeercert()
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py", line 360, in getpeercert
      'subjectAltName': get_subj_alt_name(x509)
  
    File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py", line 211, in get_subj_alt_name
      x509.SubjectAlternativeName
  
    File "C:\Users\parke\AppData\Roaming\Python\Python37\site-packages\cryptography\x509\extensions.py", line 131, in get_extension_for_class
      "No {} extension was found".format(extclass), extclass.oid
  
  ExtensionNotFound: No &lt;class 'cryptography.x509.extensions.SubjectAlternativeName'&gt; extension was found
  </code></pre>