#!/usr/bin/python # # Copyright (c) 2008 Fabian Affolter, Fedora Project. # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 only # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Author: Fabian Affolter # import sys, os, getpass from fedora.client.fas2 import AccountSystem def main(): username = raw_input('Username: ').strip() password = getpass.getpass('Password: ') #group_name = raw_input('Please enter the FAS group to query: ').strip() group_name = 'ambassadors' fas = AccountSystem(username=username, password=password) people = fas.people_by_groupname(group_name) # Display print "\n----------------------------------------------------" print "Total number of users in this group: ",len(people) print "----------------------------------------------------" for human in people: if not human[u'human_name'] == None: # u'human_name' and u'username' are the required fields human_name = human[u'human_name'] user_name = human[u'username'] data = "# " + "[[User:" + user_name + "| " + human_name + "]]" print data if __name__ == "__main__": sys.exit(main())