File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 12
12
print (Fore .RED + "Import error appeared. Reason: {}" .format (e ) + Style .RESET_ALL )
13
13
sys .exit ()
14
14
15
- def get_dns_info (short_domain ):
15
+ def get_dns_info (short_domain , report_file_extension ):
16
16
try :
17
17
mx_list = []
18
18
mx_records = dns .resolver .resolve (short_domain , 'MX' )
19
19
for record in mx_records :
20
20
mx_list .append (record .exchange )
21
21
if not mx_list :
22
22
mx_list .append ('MX records were not gathered' )
23
- return mx_list
23
+ if report_file_extension == 'xlsx' :
24
+ return ', ' .join (map (str , mx_list ))
25
+ elif report_file_extension == 'pdf' :
26
+ return mx_list
24
27
except dns .resolver .NoAnswer as error_noans :
25
28
print (Fore .RED + "No answer from domain about MX records. Reason: {}" .format (error_noans ))
26
29
return 'No information about MX records was gathered'
You can’t perform that action at this time.
0 commit comments