Skip to content

Commit b9c9dde

Browse files
Jason Coombsaramg
authored andcommitted
support dnspython version 2.0
See also: rthalley/dnspython#473 (comment)
1 parent 597cd24 commit b9c9dde

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

doh.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from urllib import request
1111

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

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

81-
if arg.upper() in RR_TYPES:
82-
record_type = arg.upper()
83-
continue
80+
try:
81+
if dns.rdatatype.from_text(arg.upper()):
82+
record_type = arg.upper()
83+
continue
84+
except:
85+
pass
8486

8587
if record_name == "":
8688
record_name = arg

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dnspython==1.16.0
1+
dnspython==2.0.0

0 commit comments

Comments
 (0)