コード例 #1
0
ファイル: data.py プロジェクト: Exeter/PEA_connect
	def download():
		basicinfo = getBasicUserData(from_cache=False)
		output = {}

		print(":: Downloading detailed user data")
		UserProfileService = connect.getclient('https://connect.exeter.edu/student/_vti_bin/UserProfileService.asmx?WSDL')

		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)

		counter = 0
		for username in basicinfo:
			try:
				print(":: Downloading profile of " + username + (str(counter) + " out of " +  str(len(basicinfo))).rjust(40 - len(username)))
				output[username] = getProfile(basicinfo[username])
			except:
				print(":: FAILED!")
				pass
			counter += 1
		return output
コード例 #2
0
ファイル: data.py プロジェクト: Exeter/PEA_connect
	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())