[Answer]-How to properly perform host or dig command in python

1👍

os.system(command) returns the exit_status after Executing the command (a string) in a subshell.

Better to use in the below manner:

from subprocess import Popen, PIPE
subproc = Popen(host_str + ".multi.surbl.org", stdout=PIPE, shell=True)
output, errorCode = subproc.communicate()
if errorCode == None:
    black_list = True
👤kvivek

Leave a comment