Ejemplo n.º 1
0
		ep = ENDPOINTS[0]
	
	if ep is None:
		print "x>  There are no SMART containers configured, stopping here"
		print forever_alone()
		sys.exit(1)
	
	# init SMART client
	ep_url = ep.get('url')
	smart = SMARTClient(ep.get('app_id'), ep_url, ep)
	
	
	# -------------------------------------------------------------------------- Background App
	# loop over all records and test against our rules
	if _BG:
		for record_id in smart.loop_over_records():
			record = TestRecord(smart)
			print "->  Record", record.record_id
			for rule in rules:
				print "-->  Testing against", rule.name
				if rule.match_against(record):
					print "==>  Record %s matches rule %s" % (record_id, rule.name)
					print rule.perform_actions(record)
		sys.exit(0)
	
	
	# -------------------------------------------------------------------------- Record Scoped
	smart.record_id = '665677'
	ts = TokenStore()
	known_token = ts.tokenForRecord(ep_url, smart.record_id)