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
|
import django
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
import socket
|
||||||
import datetime
|
import datetime
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.db.models import Q, Max
|
from django.db.models import Q, Max
|
||||||
|
@ -56,6 +57,11 @@ def main():
|
||||||
print("%s: %s" % (host, msg))
|
print("%s: %s" % (host, msg))
|
||||||
CrawlLog.log(crawl, msg, host=host, severity=CrawlLog.ERROR)
|
CrawlLog.log(crawl, msg, host=host, severity=CrawlLog.ERROR)
|
||||||
continue
|
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...")
|
print(" -- parsing...")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue