2020-04-14 10:45:36 -05:00
|
|
|
#!/usr/bin/env python
|
2020-01-08 13:29:58 -06:00
|
|
|
|
2018-11-08 19:45:21 +00:00
|
|
|
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import sys
|
2023-10-25 17:48:52 +03:00
|
|
|
import warnings
|
|
|
|
|
|
|
|
# supress warnings
|
|
|
|
|
|
|
|
warnings.filterwarnings("ignore")
|
2018-11-08 19:45:21 +00:00
|
|
|
|
2020-04-14 10:45:36 -05:00
|
|
|
# print "path", sys.path
|
2018-11-08 19:45:21 +00:00
|
|
|
|
|
|
|
try:
|
2020-04-14 10:45:36 -05:00
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mainsite.settings")
|
2018-11-08 19:45:21 +00:00
|
|
|
|
|
|
|
from django.core.management import execute_from_command_line
|
|
|
|
|
|
|
|
inp = sys.stdin.readline().strip()
|
2018-12-07 13:49:50 -08:00
|
|
|
if inp:
|
2020-04-14 10:45:36 -05:00
|
|
|
argv = ["in.whoisd", "pdb_whois", inp]
|
2018-12-07 13:49:50 -08:00
|
|
|
execute_from_command_line(argv)
|
2018-11-08 19:45:21 +00:00
|
|
|
|
|
|
|
except BaseException as e:
|
|
|
|
# TODO log here - need to inherit
|
2020-04-14 10:45:36 -05:00
|
|
|
# log = logging.getLogger('pdb.script.whois')
|
|
|
|
# log.exception(e)
|
2021-07-10 10:12:35 -05:00
|
|
|
print(f"an error occurred: {e}")
|
2018-11-08 19:45:21 +00:00
|
|
|
pass
|