Beispiel #1
0
 def _debug_set_cookie(self, response, spider):
     if self.debug:
         cl = [
             to_native_str(c, errors='replace')
             for c in response.headers.getlist('Set-Cookie')
         ]
         if cl:
             cookies = "\n".join("Set-Cookie: {}\n".format(c) for c in cl)
             msg = "Received cookies from: {}\n{}".format(response, cookies)
             logger.debug(msg, extra={'spider': spider})
Beispiel #2
0
 def _debug_cookie(self, request, spider):
     if self.debug:
         cl = [
             to_native_str(c, errors='replace')
             for c in request.headers.getlist('Cookie')
         ]
         if cl:
             cookies = "\n".join("Cookie: {}\n".format(c) for c in cl)
             msg = "Sending cookies to: {}\n{}".format(request, cookies)
             logger.debug(msg, extra={'spider': spider})
Beispiel #3
0
 def open_spider(self, spider):
     logger.debug("Using filesystem cache storage in %(cachedir)s" % {'cachedir': self.cachedir},
                  extra={'spider': spider})
Beispiel #4
0
 def open_spider(self, spider):
     dbpath = os.path.join(self.cachedir, '%s.leveldb' % spider.name)
     self.db = self._leveldb.LevelDB(dbpath)
     logger.debug("Using LevelDB cache storage in %(cachepath)s" % {'cachepath': dbpath}, extra={'spider': spider})
Beispiel #5
0
 def open_spider(self, spider):
     dbpath = os.path.join(self.cachedir, '%s.db' % spider.name)
     self.db = self.dbmodule.open(dbpath, 'c')
     logger.debug("Using DBM cache storage in %(cachepath)s" % {'cachepath': dbpath}, extra={'spider': spider})