for person in simplifiedTweets: places = self.yelp.searchStuff(random.choice(self.subarea), person[1]) rng = random.randint(0, len(places) - 1) address = ' '.join(places[rng]['location']) name = places[rng]['name'] googlelink = self.goo_shorten_url(address) replyTo = "@%s"% person[0] try: tweeter.updateMsg(replyTo + " #" + str(self.counter) + " " + name + " at " + googlelink) self.counter += 1 except tweeter.error.TweepyError as err: print (err) threading.Timer(self.readtime, self.getTweets).start() def goo_shorten_url(self, address): post_url = 'https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyAMjzI6DES-ntXZk-cC448DMDE3tnxaUiQ' longurl = 'http://www.google.com/maps/dir//' + address payload = {'longUrl' : longurl} headers = {'content-type' : 'application/json'} r = requests.post(post_url, data=json.dumps(payload), headers=headers) return r.json()['id'] def run(self): """Continuously post on twitter and wait for response""" self.makeTweets() self.getTweets() goEatLA = GoEatLA(Yelp.YelpSearch(),45) goEatLA.run()