def calc_list(): '''Generate data''' output = [] people_list = [] flag = 0 group_name = 'cla_done' username = raw_input("Username: "******"Password: "******" " + item[ 'username'] + " " + item['email'] + " " + str( item['country_code']) + " " + item['status'] + "\n" output_file.write(output_data) output_file.close() print 'File successfully generated!'
def get_email(): uid = raw_input("Enter the username you wish to search> ") fas = AccountSystem(username=str(USERNAME), password=str(PASSWORD)) value = fas.people_by_key(key='email', search=uid, fields=['email']) email_id = value.keys() if str(email_id)[12:][:-3] == '': print ("No email id associated to this account") else: print ("Email id to the user " + str(uid) + " is " +str(email_id)[12:][:-3]) sys.exit()
def get_email(id): print() fas = AccountSystem(username=USERNAME, password=PASSWORD) value = fas.people_by_key(key='email', search=id, fields=['email']) mail = value.keys() if str(mail)[12:][:-3] == '': print(colors.RED + "[-]NO EMAIL FOUND!!! \n[-]QUITTING NOW..." + colors.STOP + "\n") else: print(colors.GREEN + "[+]EMAIL: " + str(mail)[12:][:-3] + colors.STOP + "\n") sys.exit(0)
def get_email(username): USER_NAME = str(input("Enter your user name: ")) PASSWORD = str(input("Enter password: ")) try: fas = AccountSystem(username=USER_NAME, password=PASSWORD) people = fas.people_by_key(key='username', search=username, fields=['email']) if username in people: return people[username]['email'] return 0 except AuthError as e: print(str(e)) exit()
def calc_list(): '''Generate data''' output = [] people_list = [] flag = 0 group_name = 'cla_done' username = '******' password = '******' fas = AccountSystem(username=username, password=password) print 'Generating data file. Wait...' data = fas.people_by_key(key='username', search=u'*', fields=['human_name', 'username', 'email', 'status', 'country_code']) output_file = codecs.open('/tmp/hungary.txt', encoding='utf-8', mode='w+') for item in data.values(): if str(item['country_code']) == 'HU' and item['status'] == 'active': output_data = item['human_name'] + " " + item['username'] + " " + item['email'] + " " + str(item['country_code']) + " " + item['status'] + "\n" output_file.write(output_data) output_file.close() print 'file successfully generated'
def calc_list(): ''' Calculate a list of APAC contributors in different teams ''' output = [] people_list = [] country_list = [] flag = 0 final_output_list_as = [] final_output_list_eu = [] final_output_list_na = [] final_output_list_latam = [] final_output_list_africa = [] final_output_list_unknown = [] full_name = {'AS' : 'APAC', 'NA' : 'North America', \ 'SA' : 'LATAM', 'AF' : 'Africa', 'EU' : 'EMEA', 'Unknown' : 'Unknown'} #username = '******' #password = '******' #username = raw_input('Username: '******'Password: '******'output-log.txt', 'w') # Get a dictinary of all people in FAS data = fas.people_by_key(key='id', search=u'*', \ fields=['human_name', 'username', 'email', 'status', 'country_code', 'last_seen']) # Get a list of people in the groups we care about for group_name in group_list: log.write("Getting list for group: %s\n" % group_name) # Get the people from this group group_people = fas.group_members(group_name) #make a list of usernames of a group for person in group_people: # match our people list to all of FAS now for item in data.values(): user_name = item['username'] human_name = item['human_name'] country_code = item['country_code'] status = item['status'] #email = item['username'] + '@fedoraproject.org' last_seen = item['last_seen'] if status == 'active': # It's 'oh', not zero! if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if person['username'] == user_name: entry = [ group_name, user_name, country_code, last_seen ] if continent_code == 'AS' or continent_code == 'AU': apac_list.append(entry) elif continent_code == 'NA': na_list.append(entry) elif continent_code == 'SA': latam_list.append(entry) elif continent_code == 'AF': africa_list.append(entry) elif continent_code == 'EU': emea_list.append(entry) else: unknown_list.append(entry) else: if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if person['username'] == user_name: entry = [ group_name, user_name, country_code, last_seen ] inactive_list.append(entry) # Now we have a output list like #[['rdsharma4u', 'Ravi Datta Sharma','India','*****@*****.**','1','AS'], #['red', 'Sandro Mathys', 'Switzerland', '*****@*****.**', '10', 'EU']] log.write("ACTIVE CONTRIBUTORS LIST:\n") log.write("** APAC **\n") for person in apac_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3])) log.write("** NA **\n") for person in na_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3])) log.write("** LATAM **\n") for person in latam_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3])) log.write("** Africa **\n") for person in africa_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3])) log.write("** EMEA **\n") for person in emea_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3])) log.write("INACTIVE CONTRIBUTORS LIST:") for person in inactive_list: log.write("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3]))
from fedora.client.fas2 import AccountSystem import re fas = AccountSystem(username='******', password='******') user_id = input() ret_val = fas.people_by_key(key='email', search=user_id, fields=['id']) email = str(ret_val.keys()).split("'")[1::2] print('\n'.join(email))
username = '******' password = '******' {% if env == "staging" %} base_url = 'https://admin.stg.fedoraproject.org/accounts/' {% else %} base_url = 'https://admin.fedoraproject.org/accounts/' {% endif %} fas = AccountSystem(base_url=base_url, username=username, password=password) print 'Generating data file. Wait...' # Get a dictinary of all people in FAS data = fas.people_by_key(key='id', search=u'*', fields=['human_name', \ 'username', 'email', 'status', 'country_code', 'latitude', 'longitude']) # print data #get all data from a group group_people = fas.group_members(group_name) #make a list of usernames of a group for item in group_people: people_list.append(item['username']) # get the country list from GeoIP countries = dict(GeoIP.country_names.items()) #print countries for person in people_list: # print person for item in data.values():
def calc_list(): ''' Calculate a list of APAC contributors in different teams ''' output = [] people_list = [] country_list = [] flag = 0 final_output_list_as = [] final_output_list_eu = [] final_output_list_na = [] final_output_list_latam = [] final_output_list_africa = [] final_output_list_unknown = [] full_name = {'AS' : 'APAC', 'NA' : 'North America', \ 'SA' : 'LATAM', 'AF' : 'Africa', 'EU' : 'EMEA', 'Unknown' : 'Unknown'} # username = '******' # password = '******' username = raw_input('Username: '******'Password: '******'id', search=u'*', \ fields=['human_name', 'username', 'email', 'status', 'country_code']) # Get a list of people in the groups we care about for group_name in group_list: print "Getting list for group: %s" % group_name # Get the people from this group group_people = fas.group_members(group_name) #make a list of usernames of a group for person in group_people: # match our people list to all of FAS now for item in data.values(): user_name = item['username'] human_name = item['human_name'] country_code = item['country_code'] status = item['status'] #email = item['username'] + '@fedoraproject.org' if status == 'active': # It's 'oh', not zero! if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if continent_code == 'AS' or continent_code == 'AU': if person['username'] == user_name: entry = [ group_name, user_name, human_name, country_code ] output.append(entry) # Now we have a output list like #[['rdsharma4u', 'Ravi Datta Sharma','India','*****@*****.**','1','AS'], #['red', 'Sandro Mathys', 'Switzerland', '*****@*****.**', '10', 'EU']] for person in output: print("%s: %s - %s" % (person[0], person[1], person[2]))
from fedora.client.fas2 import AccountSystem from fedora.client import AuthError import getpass print() userName = input("Enter your Fedora Account UserName >>> ") password = getpass.getpass("Enter your Fedora Account Password >>> ") FAS = AccountSystem(username=userName, password=password) try: people = FAS.people_by_key(fields=['username', 'email']) for person in people.items(): if person[1].username == userName: print("Your Fedora Email is " + person[1].email) except: print("Error")
blank_page = "updating..." page.save(blank_page) print 'This takes loooooong time to execute...' #get all data from a group group_people = fas.group_members(group_name) #make a list of usernames of a group for item in group_people: people_list.append(item['username']) # get the country list from GeoIP countries = dict(GeoIP.country_names.items()) # Get a dictinary of all people in FAS data = fas.people_by_key(key='id', search=u'*', \ fields=['human_name', 'username', 'email', 'status', 'country_code']) for person in people_list: # break for item in data.values(): user_name = item['username'] human_name = item['human_name'] country_code = item['country_code'] status = item['status'] email = item['username'] + '@fedoraproject.org' if person == user_name: if status == 'inactive': inactive_list.append(user_name)
def calc_list(): ''' Calculate a list of APAC contributors in different teams ''' output = [] people_list = [] country_list = [] flag = 0 final_output_list_as = [] final_output_list_eu = [] final_output_list_na = [] final_output_list_latam = [] final_output_list_africa = [] final_output_list_unknown = [] full_name = {'AS' : 'APAC', 'NA' : 'North America', \ 'SA' : 'LATAM', 'AF' : 'Africa', 'EU' : 'EMEA', 'Unknown' : 'Unknown'} #username = '******' #password = '******' #username = raw_input('Username: '******'Password: '******'output-log.txt','w') # Get a dictinary of all people in FAS data = fas.people_by_key(key='id', search=u'*', \ fields=['human_name', 'username', 'email', 'status', 'country_code', 'last_seen']) # Get a list of people in the groups we care about for group_name in group_list: log.write ("Getting list for group: %s\n" % group_name) # Get the people from this group group_people = fas.group_members(group_name) #make a list of usernames of a group for person in group_people: # match our people list to all of FAS now for item in data.values(): user_name = item['username'] human_name = item['human_name'] country_code = item['country_code'] status = item['status'] #email = item['username'] + '@fedoraproject.org' last_seen = item['last_seen'] if status == 'active': # It's 'oh', not zero! if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if person['username'] == user_name: entry = [group_name, user_name, country_code, last_seen] if continent_code == 'AS' or continent_code == 'AU': apac_list.append(entry) elif continent_code == 'NA': na_list.append(entry) elif continent_code == 'SA': latam_list.append(entry) elif continent_code == 'AF': africa_list.append(entry) elif continent_code == 'EU': emea_list.append(entry) else: unknown_list.append(entry) else: if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if person['username'] == user_name: entry = [group_name, user_name, country_code, last_seen] inactive_list.append(entry) # Now we have a output list like #[['rdsharma4u', 'Ravi Datta Sharma','India','*****@*****.**','1','AS'], #['red', 'Sandro Mathys', 'Switzerland', '*****@*****.**', '10', 'EU']] log.write ("ACTIVE CONTRIBUTORS LIST:\n") log.write ("** APAC **\n") for person in apac_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] )) log.write ("** NA **\n") for person in na_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] )) log.write ("** LATAM **\n") for person in latam_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] )) log.write ("** Africa **\n") for person in africa_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] )) log.write ("** EMEA **\n") for person in emea_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] )) log.write ("INACTIVE CONTRIBUTORS LIST:") for person in inactive_list: log.write ("%s: - %s FROM %s last seen on %s\n" % (person[0], person[1], person[2], person[3] ))
def calc_list(): ''' Calculate a list of APAC contributors in different teams ''' output = [] people_list = [] country_list = [] flag = 0 final_output_list_as = [] final_output_list_eu = [] final_output_list_na = [] final_output_list_latam = [] final_output_list_africa = [] final_output_list_unknown = [] full_name = {'AS' : 'APAC', 'NA' : 'North America', \ 'SA' : 'LATAM', 'AF' : 'Africa', 'EU' : 'EMEA', 'Unknown' : 'Unknown'} # username = '******' # password = '******' username = raw_input('Username: '******'Password: '******'id', search=u'*', \ fields=['human_name', 'username', 'email', 'status', 'country_code']) # Get a list of people in the groups we care about for group_name in group_list: print "Getting list for group: %s" % group_name # Get the people from this group group_people = fas.group_members(group_name) #make a list of usernames of a group for person in group_people: # match our people list to all of FAS now for item in data.values(): user_name = item['username'] human_name = item['human_name'] country_code = item['country_code'] status = item['status'] #email = item['username'] + '@fedoraproject.org' if status == 'active': # It's 'oh', not zero! if country_code != None and country_code != 'O1' and country_code != ' ': continent_code = CONTINENT_MAP[country_code] if continent_code == 'AS' or continent_code == 'AU': if person['username'] == user_name: entry = [group_name, user_name, human_name, country_code] output.append(entry) # Now we have a output list like #[['rdsharma4u', 'Ravi Datta Sharma','India','*****@*****.**','1','AS'], #['red', 'Sandro Mathys', 'Switzerland', '*****@*****.**', '10', 'EU']] for person in output: print ("%s: %s - %s" % (person[0], person[1], person[2]))
from fedora.client.fas2 import AccountSystem fas = AccountSystem(username='******', password='******') s = input("enter a username : "******"'email': ") + 9 string = string[x:-4] print(string)
from fedora.client.fas2 import AccountSystem from fedora.client import AuthError # Get an AccountSystem object. All AccountSystem methods need to be # authenticated so you might as well give username and password here. fas = AccountSystem(username='******', password="") username = input("username you want to query : ") res = fas.people_by_key(key='username', search=username, fields=['human_name', 'email', 'id']) if len(res): out = ''' result for username : {} id : {} human_name : {} email : {} '''.format(username, res[username]['id'], res[username]['human_name'], res[username]['email']) print(out) else: print('\033[0;31mError! \nuser not found!!!\033[1;37m')