def get_repo_teams(repo_name, profile='github'):
 ret = []
 org_name = _get_config_value(profile, 'org_name')
 client = _get_client(profile)
 try:
  repo = client.get_repo('/'.join([org_name, repo_name]))
 except github.UnknownObjectException:
  raise CommandExecutionError("The '{0}' repository under the '{1}' organization could not be found.".format(repo_name, org_name))
 try:
  teams = repo.get_teams()
  for team in teams:
   ret.append({'id': team.id, 'name': team.name, 'permission': team.permission})
 except github.UnknownObjectException:
  raise CommandExecutionError("Unable to retrieve teams for repository '{0}' under the '{1}' organization.".format(repo_name, org_name))
 return ret

def get_repo_teams ( repo_name , profile = 'github' ) : ret = [ ] org_name = _get_config_value ( profile , 'org_name' ) client = _get_client ( profile ) try : repo = client . get_repo ( '/' . join ( [ org_name , repo_name ] ) ) except github . UnknownObjectException : raise CommandExecutionError ( "The '{0}' repository under the '{1}' organization could not be found." . format ( repo_name , org_name ) ) try : teams = repo . get_teams ( ) for team in teams : ret . append ( { 'id' : team . id , 'name' : team . name , 'permission' : team . permission } ) except github . UnknownObjectException : raise CommandExecutionError ( "Unable to retrieve teams for repository '{0}' under the '{1}' organization." . format ( repo_name , org_name ) ) return ret
return teams belonging to a repository .