def setUp(self):
     self.ip = '<replace_with_some_ip>'
     self.qe = query_engine()
     self.pos = self.qe.get_location_and_coordinates_from_ip(self.ip)
     #print self.pos
     self.de = decision_engine()
     self.redis_service = redis_service()
Esempio n. 2
0
def pipeline(*argv):
    # add feat preprocessing here
    ls = feature_preprocessing(*argv)

    # prediction portion
    p = predict(ls)

    # post processing here...if required
    res = decision_engine(p)
    return res
Esempio n. 3
0
 def get(self):
     remote_ip = self.request.remote_ip
     if remote_ip:
         qe = query_engine()
         pos = qe.get_location_and_coordinates_from_ip(remote_ip)
         if pos:
             location = pos['location']
             if not location:
                 location = 'unknown'
             weather_report = qe.get_weather_report(pos)
             if weather_report:
                 de = decision_engine()
                 decision = de.get_decision(weather_report)
                 if decision is not None:
                     self.write(decision + ' visitor from ' + location +'.')
                     self.write('\n')
                 else:
                     self.write('The weather algorithm has no decision, you are on your own.')
             else:
                 self.write("We couldn't get a weather report for this location, try later")
         else:
             self.write("Apologies, Could not geolocate your machine.")
     else:
         self.write("Hmm you don't seem to have an ip, what goes?.")