title: How to access the list of Azure AD Groups using python?
body: <p>I'm new to python. I found the following sample code to retrieve the Azure AD groups from <a href="https://msdn.microsoft.com/en-us/Library/Azure/Ad/Graph/api/groups-operations#BasicoperationsongroupsGetgroups" rel="nofollow">https://msdn.microsoft.com/en-us/Library/Azure/Ad/Graph/api/groups-operations#BasicoperationsongroupsGetgroups</a></p>
  
  <p>the code is:</p>
  
  <pre><code>########### Python 3.2 #############
  import http.client, urllib.request, urllib.parse, urllib.error, base64
  
  # OAuth2 is required to access this API. For more information visit: https://msdn.microsoft.com/en-us/office/office365/howto/common-app-authentication-tasks
  
  headers = {}
  
  params = urllib.parse.urlencode({
  # Specify values for the following required parameters
  'api-version': '1.5',
  })
  
  try:
      conn = http.client.HTTPSConnection('graph.windows.net')
      #Specify values for path parameters (shown as {...}) and request body if needed
      conn.request("GET", "/myorganization/groups?%s" % params, "", headers)
      response = conn.getresponse()
      data = response.read()
      print(data)
      conn.close()
  except Exception as e:
      print("[Errno {0}] {1}".format(e.errno, e.strerror))
  
  ####################################
  </code></pre>
  
  <p>everything is fine but i don't know what would be the value of "headers = {}".</p>
  
  <p>I need help i spent a lot of hours on this but no luck yet.</p>