当前位置: 首页>>代码示例>>Python>>正文


Python Feed.entries方法代码示例

本文整理汇总了Python中models.Feed.entries方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.entries方法的具体用法?Python Feed.entries怎么用?Python Feed.entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Feed的用法示例。


在下文中一共展示了Feed.entries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: open

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import entries [as 别名]
        with open(join(PATH, 'urls', urls_filename)) as urls:
            urls = urls.read().splitlines()
            ignored = lambda url: not url.strip().startswith('#')
            urls = filter(ignored, urls)
            urls = filter(None, urls)

        # Path to scraped feed data for this state.
        STATE_FEED_DATA = join('data', 'feeds')

        try:
            shutil.rmtree(STATE_FEED_DATA)
        except OSError:
            pass

        try:
            os.makedirs(STATE_FEED_DATA)
        except OSError:
            pass

        extractor = Extractor(abbr)
        for url in urls:
            feed = Feed(url)
            for entry in feed.entries():
                extractor.process_entry(entry.entry)
                import ipdb;ipdb.set_trace()
                entry.finish_report(abbr)
                entry.save_if_entities_found()
            feed.finish_report()
            feed.save()

开发者ID:VersaHQ,项目名称:openstates,代码行数:31,代码来源:scrape.py

示例2: filter

# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import entries [as 别名]
            urls = filter(ignored, urls)
            urls = filter(None, urls)

        # Path to scraped feed data for this state.
        STATE_FEED_DATA = join('data', 'feeds')

        try:
            shutil.rmtree(STATE_FEED_DATA)
        except OSError:
            pass

        try:
            os.makedirs(STATE_FEED_DATA)
        except OSError:
            pass

        extractor = Extractor(abbr)
        for url in urls:
            feed = Feed(url, jurisdiction=abbr)
            import ipdb;ipdb.set_trace()
            et = list(feed.entries())
            if not et:
                import ipdb;ipdb.set_trace()
            for entry in feed.entries():
                extractor.process_entry(entry.entry)
                entry.finish_report(abbr)
                entry.save_if_entities_found()
            feed.finish_report()
            feed.save()

开发者ID:jwmajors81,项目名称:openstates,代码行数:31,代码来源:scrape.py


注:本文中的models.Feed.entries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。