code: def get_contributors(gh, repo_id):
      
      try:
          # FIXME: Use `github3.Repository.contributors` to get this information
          contrib_url = gh.repository_with_id(repo_id).contributors_url
  
          r = requests.get(contrib_url)
          if r.status_code == 200:
              contributors = r.json()
  
              def get_author(contributor):
                  r = requests.get(contributor['url'])
                  if r.status_code == 200:
                      data = r.json()
                      return dict(
                          name=(data['name'] if 'name' in data and data['name']
                                else data['login']),
                          affiliation=data.get('company') or '',
                      )
  
              # Sort according to number of contributions
              contributors.sort(key=itemgetter('contributions'))
              contributors = [get_author(x) for x in reversed(contributors)
                              if x['type'] == 'User']
              contributors = filter(lambda x: x is not None, contributors)
  
              return contributors
      except Exception:
          return None
docs: Get list of contributors to a repository.