Socket test if host is online
This commit is contained in:
parent
2fea65579b
commit
6b53bcf359
|
@ -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():
|
|||
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…
Reference in New Issue