Exemple #1
0
    def post(self):
		q = self.request.POST.get('q')
		answers = []
		for spec in configobject['lexicon']:
			res = brains.select(brains.parse(spec, [Tweet(q)]))
			for item in res:
				answers.append(brains.compose(item).tariff_bot_says)
		
		self.response.headers['Content-Type'] = 'application/json'
		self.response.out.write(json.dumps(answers))
Exemple #2
0
    def post(self):
        q = self.request.POST.get('q')
        answers = []
        for spec in configobject['lexicon']:
            res = brains.select(brains.parse(spec, [Tweet(q)]))
            for item in res:
                answers.append(brains.compose(item).tariff_bot_says)

        self.response.headers['Content-Type'] = 'application/json'
        self.response.out.write(json.dumps(answers))
Exemple #3
0
	def get(self):
		self.response.headers['Content-Type'] = 'text/plain'
		api = brains.t_con()
		
		for spec in configobject['lexicon']:
			for_me = api.search(configobject['my_handle'])
			results = brains.parse(spec, for_me)
			results = brains.select(results)
			for tweet in results:
				tweet.respond = True
				self.response.out.write('Tweeted\n')
				self.response.out.write(brains.send(brains.compose(tweet)).tariff_bot_says)
				self.response.out.write('\nIn response to:\n')
				self.response.out.write(tweet.text)
				self.response.out.write('\n')
				self.response.out.write('\n')
Exemple #4
0
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        api = brains.t_con()

        for spec in configobject['lexicon']:
            for_me = api.search(configobject['my_handle'])
            results = brains.parse(spec, for_me)
            results = brains.select(results)
            for tweet in results:
                tweet.respond = True
                self.response.out.write('Tweeted\n')
                self.response.out.write(
                    brains.send(brains.compose(tweet)).tariff_bot_says)
                self.response.out.write('\nIn response to:\n')
                self.response.out.write(tweet.text)
                self.response.out.write('\n')
                self.response.out.write('\n')
Exemple #5
0
	def get(self):
		self.response.headers['Content-Type'] = 'text/plain'
		api = brains.t_con()
		for spec in configobject['lexicon']:
			self.response.out.write('Twitter search for ' + spec['twitter_search_term'] + '\n')
			results = api.search(spec['twitter_search_term'])

			results = brains.parse(spec, results)

			results = brains.select(results, needhashtags = True)
			tweeted = []
			for result in results:
				self.response.out.write(u"found: " + unicode(results))
				result.respond = True #respond to everyone now.
				tweeted.append(brains.send(brains.compose(result)))
			
			for tweet in tweeted:
				self.response.out.write('Tweeted\n')
				self.response.out.write(tweet.tariff_bot_says)
				self.response.out.write('\nIn response to:\n')
				self.response.out.write(tweet.text)
				self.response.out.write('\n')
				self.response.out.write('\n')
Exemple #6
0
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        api = brains.t_con()
        for spec in configobject['lexicon']:
            self.response.out.write('Twitter search for ' +
                                    spec['twitter_search_term'] + '\n')
            results = api.search(spec['twitter_search_term'])

            results = brains.parse(spec, results)

            results = brains.select(results, needhashtags=True)
            tweeted = []
            for result in results:
                self.response.out.write(u"found: " + unicode(results))
                result.respond = True  #respond to everyone now.
                tweeted.append(brains.send(brains.compose(result)))

            for tweet in tweeted:
                self.response.out.write('Tweeted\n')
                self.response.out.write(tweet.tariff_bot_says)
                self.response.out.write('\nIn response to:\n')
                self.response.out.write(tweet.text)
                self.response.out.write('\n')
                self.response.out.write('\n')