Пример #1
0
    def get(self):
        a = AnalysesHandler()

        analyses_gdata = AnalysisGData.gql(
            "ORDER BY created_at DESC LIMIT 0,1")

        template_values = {
            'gdata': analyses_gdata[0].gdatas,
            'BristolSentiment': "%.2f" % a.getAnalysisForPlace('Bristol'),
            'OxfordSentiment': "%.2f" % a.getAnalysisForPlace('Oxford'),
            'LondonSentiment': "%.2f" % a.getAnalysisForPlace('London'),
            'YorkSentiment': "%.2f" % a.getAnalysisForPlace('York'),
            'MargateSentiment': "%.2f" % a.getAnalysisForPlace('Margate'),
            'BristolImg': a.getImageForScore(a.getAnalysisForPlace('Bristol')),
            'OxfordImg': a.getImageForScore(a.getAnalysisForPlace('Oxford')),
            'LondonImg': a.getImageForScore(a.getAnalysisForPlace('London')),
            'YorkImg': a.getImageForScore(a.getAnalysisForPlace('York')),
            'MargateImg': a.getImageForScore(a.getAnalysisForPlace('Margate')),
            'sitename': "Twitty City"
        }
        loader = FileSystemLoader(os.path.dirname(__file__) + '/../templates/')
        env = Environment(loader=loader)

        template = env.get_template('index.html')

        self.response.out.write(template.render(template_values))
Пример #2
0
    def get(self):
        a = AnalysesHandler()

        analyses_gdata = AnalysisGData.gql("ORDER BY created_at DESC LIMIT 0,1")

        template_values = {
            'gdata': analyses_gdata[0].gdatas,
            'BristolSentiment': "%.2f" % a.getAnalysisForPlace('Bristol'),
            'OxfordSentiment': "%.2f" % a.getAnalysisForPlace('Oxford'),
            'LondonSentiment': "%.2f" % a.getAnalysisForPlace('London'),
            'YorkSentiment': "%.2f" % a.getAnalysisForPlace('York'),
            'MargateSentiment': "%.2f" % a.getAnalysisForPlace('Margate'),
            'BristolImg': a.getImageForScore(a.getAnalysisForPlace('Bristol')),
            'OxfordImg': a.getImageForScore(a.getAnalysisForPlace('Oxford')),
            'LondonImg': a.getImageForScore(a.getAnalysisForPlace('London')),
            'YorkImg': a.getImageForScore(a.getAnalysisForPlace('York')),
            'MargateImg': a.getImageForScore(a.getAnalysisForPlace('Margate')),
            'sitename': "Twitty City"
        }
        loader = FileSystemLoader(os.path.dirname(__file__) + '/../templates/')
        env = Environment(loader=loader)

        template = env.get_template('index.html')

        self.response.out.write(template.render(template_values))
Пример #3
0
    def get(self):
        self.response.headers["Content-Type"] = "text/plain"

        a = AnalysesHandler()

        analyses = (
            a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace("Bristol", 7))
            + a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace("York", 7))
            + a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace("London", 7))
            + a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace("Margate", 7))
            + a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace("Oxford", 7))
        )

        gdata = AnalysisGData(created_at=datetime.now(), gdatas=analyses)
        gdata.put()

        self.response.out.write("Wrote: \n %s \n to db." % analyses)
Пример #4
0
    def get(self):
        a = AnalysesHandler()

        self.response.headers["Content-Type"] = "text/plain"
        myplace = self.request.get('place')
        a.runAnalysisForPlace(myplace, self.response)
Пример #5
0
    def get(self):
        self.response.headers["Content-Type"] = "text/plain"

        a = AnalysesHandler()

        analyses = a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace('Bristol', 7)) + \
            a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace('York', 7)) + \
            a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace('London', 7)) + \
            a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace('Margate', 7)) + \
            a.getGDataForAnalyses(a.getDaysOfAnalysisForPlace('Oxford', 7))

        gdata = AnalysisGData(created_at=datetime.now(), gdatas=analyses)
        gdata.put()

        self.response.out.write("Wrote: \n %s \n to db." % analyses)