Ejemplo n.º 1
0
Archivo: cli.py Proyecto: Teifion/Rob3
def find_requests(options):
	from queries import team_q
	from functions import request_f
	cursor = database.get_cursor()
	
	team_dict = team_q.get_real_active_teams(cursor)
	topic_list = []
	lookup = {}
	for k, v in team_dict.items():
		if v.request_topic > 0:
			topic_list.append(str(v.request_topic))
			lookup[str(v.request_topic)] = v.id
	
	topic_list = ",".join(topic_list)
	# print(topic_list)
	getter_data = "p=%s&mode=find_request_topics&topic_list=%s" % (common.data['getterPass'], topic_list)
	
	topics_to_read = urllib.request.urlopen(common.data['getter_url'], getter_data).read().strip().decode('utf-8')
	
	topic_list = topics_to_read.split("\n")
	
	if len(topic_list) < 1:
		if options.verbose:
			print(database.shell_text("No requests found"))
		return
	
	teams_to_read = []
	for t in topic_list:
		if t == '': continue
		teams_to_read.append(lookup[t])
	
	for t in teams_to_read:
		print(request_f.msn_run_orders(database.get_cursor(), t))
		time.sleep(options.delay)
	
	if options.verbose:
		print(database.shell_text("[g]Ran %d requests[/g]" % len(teams_to_read)))
Ejemplo n.º 2
0
def run_requests(cursor, email, the_player, args):
	if the_player == None: return msn_auth_needed()
	
	return request_f.msn_run_orders(cursor, the_player.team)