title: Google Directory API groups
body: <p>I am trying to use Google's admin directory API (with Google's python library).</p>
  
  <p>I am able to list the users on the directory just fine, using some code like this:</p>
  
  <pre><code>results = client.users().list(customer='my_customer').execute()
  </code></pre>
  
  <p>However, those results do not include which groups the users are a member of.  Instead, it appears that once I have the list of users, I then have to make a call to get a list of groups:</p>
  
  <pre><code>results = client.groups().list(customer='my_customer').execute()
  </code></pre>
  
  <p>And then go through each group and call the "members" api to see which users are in a group:</p>
  
  <pre><code>results = client.members().list(groupKey='[group key]').execute()
  </code></pre>
  
  <p>Which means that I have to make a new request for every group.</p>
  
  <p>It seems to be horribly inefficient.  There has to be a better way than this, and I'm just missing it.  What is it?</p>