Skip to content

Commit

Permalink
Trying to fix unicode (#36)
Browse files Browse the repository at this point in the history
* pulling all the debuging out

* taking all the logging out
  • Loading branch information
altf4arnold authored May 7, 2024
1 parent 3f6b395 commit bd0275c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tldtester/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Link to IANA website : https://www.internic.net/domain/root.zone
"""
import json
import config
import urllib.request
from tldtester.models import TLD, RootZone
from django.core.exceptions import MultipleObjectsReturned
Expand Down Expand Up @@ -45,8 +44,6 @@ def zonesorter(zonefile):
Takes the zonefile as an input and writes the records to the database
"""
for line in zonefile:
if config.DEBUG is True:
print(line)
value = ""
record = line.split()
if len(record) >= 5:
Expand All @@ -59,8 +56,6 @@ def zonesorter(zonefile):
value = value + record[i + 4] + " "
towrite = {"name": name, "type": recordtype, "value": value}
zonedbwriter(towrite)
if config.DEBUG is True:
print("Done Parsing the Zones")


def zonedbwriter(recs):
Expand Down Expand Up @@ -101,8 +96,6 @@ def grabber(data, rdaptlds):
analyses the v4, v6 and DNSSEC. Returns a list of dictionaries with all the vallues to write in the database
"""
for tld in data:
if config.DEBUG is True:
print("starting with " + tld)
nsservers = []
dnsseckeys = []
Arecords = 0
Expand Down Expand Up @@ -147,8 +140,7 @@ def grabber(data, rdaptlds):
# Who registers the thing and get unicode
rdap = urllib.request.urlopen("https://root.rdap.org/domain/" + tld)
if rdap.getcode() == 200:
raw = rdap.read()
raw = raw.decode("utf-8")
raw = rdap.read().decode("utf-8")
data = json.loads(raw)
try:
if "xn--" in tld:
Expand Down Expand Up @@ -177,8 +169,6 @@ def grabber(data, rdaptlds):
results = {"tld": tld, "unicodeTld": unicodetld, "nsserveramount": int(len((nsservers))),
"organisation": organisation, "v4resolvers": Arecords, "v6resolvers": AAAArecords, "algo": algo,
"amountofkeys": amountofkeys, "link": link, "rdap": rdap}
if config.DEBUG is True:
print(results)
tlddbwriter(results)


Expand Down

0 comments on commit bd0275c

Please sign in to comment.