Example #1
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     log.msg(format="Telnet console listening on %(host)s:%(port)d",
             level=log.DEBUG,
             host=h.host,
             port=h.port)
Example #2
0
 def start_listening(self):
     check_sql = "select * from spider_spiderinfo where name=%s"
     insert_sql = "insert into spider_spiderinfo (name,ip,port,status) values ('%s','%s','%s','START')"
     update_sql = "update spider_spiderinfo set ip='%s',port='%s',status='START' where name='%s'"
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     ip_address = GetLocalIP.get_ip_address('enp3s0')
     port = h.port
     self.spider_name = self.crawler.engine.spider.name
     spider_name = self.spider_name
     try:
         self.cursor.execute(check_sql, (spider_name, ))
         check_result = len(self.cursor.fetchall())
         if check_result != 0:
             self.cursor.execute(update_sql %
                                 (ip_address, port, spider_name))
             self.db_connection.commit()
         else:
             self.cursor.execute(insert_sql %
                                 (spider_name, ip_address, port))
             self.db_connection.commit()
     except Exception as e:
         print Exception, ":", e
     logger.info("Telnet console listening on %(host)s:%(port)d", {
         'host': h.host,
         'port': h.port
     },
                 extra={'crawler': self.crawler})
Example #3
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     log.msg(format='Web service listening on %(host)s:%(port)d',
             level=log.DEBUG,
             host=h.host,
             port=h.port)
Example #4
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     logger.debug("Telnet console listening on %(host)s:%(port)d", {
         'host': h.host,
         'port': h.port
     },
                  extra={'crawler': self.crawler})
Example #5
0
    def engine_started(self):
        # Start server endpoint for exporting metrics
        self.promtheus = listen_tcp(self.port, self.host, self)

        # Periodically update the metrics
        tsk = task.LoopingCall(self.update)
        self.tasks.append(tsk)
        tsk.start(self.interval, now=True)
Example #6
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     logger.info(
         "Telnet console listening on %(host)s:%(port)d",
         {"host": h.host, "port": h.port},
         extra={"crawler": self.crawler},
     )
Example #7
0
    def start_listening(self):
        resource = WebSocketResource(self)

        # serve files from ./client
        root = File(STATIC_FILES)
        root.putChild(b"ws", resource)
        site = Site(root)
        self.port = listen_tcp(self.portrange, self.host, site)
        h = self.port.getHost()
        self.logger.debug("Inspectr available on %(host)s:%(port)d",
                     {'host': h.host, 'port': h.port},
                     extra={'crawler': self.crawler})
        if self.crawler.settings.get('INSPECTR_AUTOSTART', None):
            webbrowser.open('http://{}:{}'.format(h.host, h.port))
Example #8
0
File: telnet.py Project: 01-/scrapy
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     logger.debug("Telnet console listening on %(host)s:%(port)d",
                  {'host': h.host, 'port': h.port},
                  extra={'crawler': self.crawler})
Example #9
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     log.msg("Web service listening on %s:%d" % (h.host, h.port), log.DEBUG)
Example #10
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     log.msg(format="Telnet console listening on %(host)s:%(port)d",
             level=log.DEBUG, host=h.host, port=h.port)
Example #11
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     h = self.port.getHost()
     log.msg(format='Web service listening on %(host)s:%(port)d',
             level=log.DEBUG, host=h.host, port=h.port)
Example #12
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     logger.debug(
         'Web service listening on {host.host:s}:{host.port:d}'.format(
             host=self.port.getHost()))
Example #13
0
 def start_listening(self):
     self.port = listen_tcp(self.port_range, self.host, self)
     h = self.port.getHost()
     logger.debug('listening on %(host)s: %(port)d',
                  {'host': h.host, 'port': h.port})
Example #14
0
 def start_listening(self):
     self.port = listen_tcp(self.portrange, self.host, self)
     logger.debug(
         'Web service listening on {host.host:s}:{host.port:d}'.format(
             host=self.port.getHost()))