Beispiel #1
0
def index_zhihu_daily(params):
    """建立索引
    """
    if 'date' not in params:
        date_str = today_str()
    else:
        date_str = params['date'][0]
    news_list = fetch_apis.get_news_list(date_str)
    if news_list:
        fetch_apis.index_news_list(news_list)
Beispiel #2
0
def index_zhihu_daily(params):
    """建立索引
    """
    if 'date' not in params:
        date_str = today_str()
    else:
        date_str = params['date'][0]
    news_list = fetch_apis.get_news_list(date_str)
    if news_list:
        fetch_apis.index_news_list(news_list)
Beispiel #3
0
    def get(self, *args, **kwargs):
        # 获取日期
        date_str = self.get_argument("date", today_str())

        # 获取日报
        try:
            news_list = get_daily_news(date_str)

            before_date_str = yesterday_date_str(date_str)
            after_date_str = tomorrow_date_str(date_str) \
                if today_str() != date_str else None
        except Exception as e:
            import traceback
            stack = traceback.format_exc()
            logging.error("get daily news failed date_str:%s error:%s cause:%s"
                          % (date_str, e, stack))
            self.write_error(404, reason="Invalidate date {%s}" % date_str)
        else:
            self.render("daily.html", news_list=news_list,
                        before_date=before_date_str,
                        after_date=after_date_str)
Beispiel #4
0
    def get(self, *args, **kwargs):
        # 获取日期
        date_str = self.get_argument("date", today_str())

        # 获取日报
        try:
            news_list = get_daily_news(date_str)

            before_date_str = yesterday_date_str(date_str)
            after_date_str = tomorrow_date_str(date_str) \
                if today_str() != date_str else None
        except Exception as e:
            import traceback
            stack = traceback.format_exc()
            logging.error(
                "get daily news failed date_str:%s error:%s cause:%s" %
                (date_str, e, stack))
            self.write_error(404, reason="Invalidate date {%s}" % date_str)
        else:
            self.render("daily.html",
                        news_list=news_list,
                        before_date=before_date_str,
                        after_date=after_date_str)