Open magicjohnson opened 8 months ago
I would like to point out that the error happens when the library checks for invalid dmarc records in the root, for example a TXT record on the root domain that contains DMARC1
. I think it would be good to be able to bypass the root servers check.
I think fix does not work: undecoded bytes object just passed as is to root_record which causes further exception.
File "python3.12/site-packages/checkdmarc/dmarc.py", line 1013, in get_dmarc_record
query = query_dmarc_record(domain, nameservers=nameservers,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python3.12/site-packages/checkdmarc/dmarc.py", line 502, in query_dmarc_record
if root_record.startswith("v=DMARC1"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Hi,
I'm still getting this issue when submitting, for instance, the domain edys.com.
. I'm using Python 3.9.18
and version 5.3.1
of this package.
answer = dmarc.query_dmarc_record(fqdn, nameservers=ns, timeout=2.0)
File "/app/checkdmarc/dmarc.py", line 502, in query_dmarc_record
if root_record.startswith("v=DMARC1"):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
From what I can understand, an invalid undecoded bytes object caught by the existing try block is still added to the final list of resulting records due to pass
in the except
(should it be continue
instead or the append be moved inside the try block?).
query_dmarc_record
did work on 4.8.5, but after update it raises error because root TXT record contains non-decodable characters (\148 or \x94).