def getProfile(user): def clean(dirtyprofile): output = {} for x in dirtyprofile['PropertyData']: if x['Privacy'] == "Private": continue k = x['Name'] if k == 'employeeID': k = 'EmployeeID' elif k == 'UserName': k = 'Username' elif k == 'Courses': k = 'Classes' values = x['Values'] if values =="": continue v = [] for value in values['ValueData']: v.append(value['Value']) if (len(v) == 1) and (k not in ['Organizations', 'Classes']): v = v[0] output[k] = v return output dirtyprofile = connect.to_dict(UserProfileService.service.GetUserProfileByName(user['login'])) return clean(dirtyprofile)
def download(): print(":: Downloading raw user data") UserGroup = connect.getclient('https://connect.exeter.edu/_vti_bin/usergroup.asmx?WSDL') return connect.to_dict(UserGroup.service.GetAllUserCollectionFromWeb())