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


Python log.DEBUG属性代码示例

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


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

示例1: process_item

# 需要导入模块: from scrapy import log [as 别名]
# 或者: from scrapy.log import DEBUG [as 别名]
def process_item(self, item, spider):
        """
        Scrape edilen her girdiyi veritabanina ekle. Bu method sayfa process edildikten, icerisindeki
        bilgiler cekildikten ve Item objesi olusturulduktan sonra her seferinde cagriliyor.

        :param item: Parse edilmis nesne
        :type item: Scrapy item
        :param spider: Su anda calisan, spiders/ dizini altinda belirtilen spiderlardan herhangi biri
        :type spider: Scrapy spider
        :return: Gonderilen Item
        :rtype: Scrapy item
        """
        log.msg('[%s] PROCESSING ITEM [item no: %s, baslik: %s]' %
                (spider.name, item['girdi_id'], item['baslik']),
                level=log.DEBUG)

        girdi = Girdi(**item)
        try:
            session.add(girdi)
            session.commit()
        except:
            session.rollback()
            raise
        finally:
            session.close()

        return item 
开发者ID:eren,项目名称:sozlukcrawler,代码行数:29,代码来源:pipelines.py

示例2: request_seen

# 需要导入模块: from scrapy import log [as 别名]
# 或者: from scrapy.log import DEBUG [as 别名]
def request_seen(self, request):
        is_seen = is_request_seen(request)

        if not is_seen:
            log.msg('New URL: %s. Adding it to seen database' % request.url, log.DEBUG)
            seen = Seen(fingerprint=request_fingerprint(request),
                        url=request.url,
                        last_crawl_time=datetime.now())
            try:
                session.add(seen)
                session.commit()
            except:
                session.rollback()
                raise
            finally:
                session.close()
        else:
            log.msg('[seen] "%s" is seen. Skipping.' % request.url, log.INFO)

        return is_seen 
开发者ID:eren,项目名称:sozlukcrawler,代码行数:22,代码来源:dupefilter.py

示例3: debug

# 需要导入模块: from scrapy import log [as 别名]
# 或者: from scrapy.log import DEBUG [as 别名]
def debug(msg):
    log.msg(str(msg), level=log.DEBUG) 
开发者ID:geekan,项目名称:google-scholar-crawler,代码行数:4,代码来源:log.py

示例4: process_spider_output

# 需要导入模块: from scrapy import log [as 别名]
# 或者: from scrapy.log import DEBUG [as 别名]
def process_spider_output(self, response, result, spider):
        for x in result:
            if isinstance(x, Request) and hasattr(spider, 'disallow_urls'):
                if self.should_follow(x, spider):
                    yield x
                else:
                    log.msg("Filtered URL %s: " % (x.url),
                            level=log.DEBUG, spider=spider)
            else:
                yield x 
开发者ID:tryolabs,项目名称:daywatch,代码行数:12,代码来源:middleware.py

示例5: dropped

# 需要导入模块: from scrapy import log [as 别名]
# 或者: from scrapy.log import DEBUG [as 别名]
def dropped(self, item, exception, response, spider):
        return {
            'level': log.DEBUG,
            'msg': logformatter.DROPPEDMSG,
            'args': {
                'exception': exception,
                'item': item,
            }
        } 
开发者ID:yinzishao,项目名称:NewsScrapy,代码行数:11,代码来源:polite_log_formatter.py


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