Skip to content

Commit

Permalink
support dnspython version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Coombs authored and aramg committed Oct 26, 2020
1 parent 597cd24 commit b9c9dde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions doh.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from urllib import request

DEFAULT_SERVER = "https://doh.opendns.com"
RR_TYPES = dns.rdatatype._by_text.keys()

def usage():
print("Usage: doh [@[http[s]://]server[:port]] [TYPE] [+nosslverify] domain")
Expand Down Expand Up @@ -78,9 +77,12 @@ def main(argv):
ssl_ctx.verify_mode = ssl.CERT_NONE
continue

if arg.upper() in RR_TYPES:
record_type = arg.upper()
continue
try:
if dns.rdatatype.from_text(arg.upper()):
record_type = arg.upper()
continue
except:
pass

if record_name == "":
record_name = arg
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dnspython==1.16.0
dnspython==2.0.0

0 comments on commit b9c9dde

Please sign in to comment.