-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polls correct data and has it in text
- Loading branch information
1 parent
05ca06b
commit 963616f
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
This file is dumping the IANA root zone and sorting it in the database | ||
Link to IANA website : https://www.internic.net/domain/root.zone | ||
""" | ||
import urllib.request | ||
|
||
|
||
def downloader(): | ||
""" | ||
Downloads the data. Returns None if not working, Returns data if working | ||
""" | ||
url = urllib.request.urlopen("https://www.internic.net/domain/root.zone") | ||
if url.getcode() == 200: | ||
raw = url.read() | ||
raw = raw.decode("utf-8") | ||
else: | ||
raw = None | ||
return raw | ||
|
||
|
||
def sorter(rawdata): | ||
""" | ||
This file removes the tabs and line breaks from rawdata | ||
returns as a list with dictionary in it | ||
""" | ||
print(str(rawdata)) | ||
|
||
|
||
def main(): | ||
try: | ||
sorter(downloader()) | ||
except Exception as e: | ||
print(e) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |