title: How do I connect with Python to a RESTful API using keys instead of basic authentication username and password?
body: <p>I am new to programming, and was asked to take over a project where I need to change the current Python code we use to connect to a Ver 1 RESTful API. The company has switched to their Ver 2 of the API and now require IDs and Keys for authentication instead of the basic username and password. The old code that worked for the Ver 1 API looks like this:</p>
  
  <pre><code>import requests
  import simplejson as json
  import pprintpp as pprint
  
  #API_Ver1 Auth
  USER = 'username'
  PASS = 'password'
  url = 'https://somecompany.com/api/v1/groups'
  s = requests.Session()
  s.auth = (USER, PASS)
  
  r = json.loads(s.get(url).text)
  groups = r["data"]
  </code></pre>
  
  <p>I can connect to the Ver 2 API via a terminal using a cURL string like this:</p>
  
  <p>curl -v -X GET -H "X-ABC-API-ID:x-x-x-x-x" -H "X-ABC-API-KEY:nnnnnnnnnnnnnnnnnnnnnnn" 
  -H "X-DE-API-ID:x" -H "X-DE-API-KEY:nnnnnnnnnnnnnnnnnnnnnnnn" 
  "<a href="https://www.somecompany.com/api/v2/groups/" rel="noreferrer">https://www.somecompany.com/api/v2/groups/</a>"</p>
  
  <p>I have searched, but have been unsuccessful in finding a way to get the IDs and Keys from the cURL string to allow access to the Ver 2 API using Python. Thanks for your consideration in helping a noob get through this code change! </p>