domainaware / checkdmarc

A parser for SPF and DMARC DNS records
https://domainaware.github.io/checkdmarc
Apache License 2.0
245 stars 76 forks source link

how to run from a .py script #60

Closed sdebarun closed 3 years ago

sdebarun commented 3 years ago

Hi, I'm completely new in python and is trying to get the code run from within a .py script. something like this

 import checkdmarc
 def dmarc():
    return checkdmarc fbi.gov
 dmarc();   

I am trully sorry if that is a silly question as I do not know how to do it. I am trying the code but it gives me a syntax error.


 return checkdmarc "fbi.gov"
                      ^
SyntaxError: invalid syntax

can anyone help or point me to some direction? Thanks,

sdebarun commented 3 years ago

found a way to achieve what I wanted too

import os
os.system('checkdmarc mailkit.com')

but is it a good way to do it? Also I need to loop through and reoraganize the json as per my need from the uotput. How do I do that?

seanthegeek commented 3 years ago

use checkdmarc.check_domains

https://domainaware.github.io/checkdmarc/checkdmarc.html#checkdmarc.check_domains