#!/usr/bin/env # this takes all the quotes into a pad and uses them as responses to a message triggers_url = 'http://192.168.73.188/etherdump/bot-script-triggers.raw.txt' target_url = 'http://192.168.73.188/etherdump/not-so-utopian_open_source_pedagogies.raw.txt' interactions = [] responses = [] triggers = [] for line in urllib2.urlopen(triggers_url): line = line.replace('\n','') triggers.append(line) print triggers for line in urllib2.urlopen(target_url): finds = re.findall(r'"([^"]*)"', line) for find in finds: responses.append('"' + find + '"') response = random.choice(responses) interactions = [{'triggers': triggers, 'response': response}] # print interactions EXAMPLE OUTPUT