def get_contacts(token, group=None, index=1, max=100):
  """ retrieves the list of contacts for the given email address, token needs
      to be authorised for this user """
  c = client()
  c.override_token = token
  
  logging.info("TOKEN %s", token)

  resource = CONTACTS_RESOURCE % (index, max + 1)
  if group:
    resource += "&" + urllib.urlencode({'group': group})


  logging.info("Starting fetch of GData feed at %s", resource)

  more = False
  try:
    feed_json = c.Get(resource, converter=converter)
    rv = simplejson.loads(feed_json)
    if len(rv['feed']['entry']) > max:
      more = index + max
  except gdata.service.RequestError, e:
    raise
    if e.args and 'status' in e.args[0] and e.args[0]['status'] == 401:
      raise exception.ServiceError('Invalid AuthSub token')
    raise
  
  return rv['feed']['entry'][:max], more
dataset/ETHPy150Open CollabQ/CollabQ/common/google_contacts.py/get_contacts/original