Browse Source

Socket test if host is online

master
Sebastian Lohff 5 years ago
parent
commit
6b53bcf359
  1. 6
      bin/crawl.py

6
bin/crawl.py

@ -12,6 +12,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings") @@ -12,6 +12,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings")
import django
django.setup()
import socket
import datetime
from django.utils import timezone
from django.db.models import Q, Max
@ -56,6 +57,11 @@ def main(): @@ -56,6 +57,11 @@ def main():
print("%s: %s" % (host, msg))
CrawlLog.log(crawl, msg, host=host, severity=CrawlLog.ERROR)
continue
except socket.error as e:
msg = "Could not reach host: %s" % (e,)
print("%s: %s" % (host, msg))
CrawlLog.log(crawl, msg, host=host, severity=CrawlLog.ERROR)
continue
print(" -- parsing...")

Loading…
Cancel
Save