Skip to content

closes #83 #53 #90 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pythonwhois/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,20 @@ def parse_raw_whois(raw_data, normalized=None, never_query_handles=True, handle_
# SIDN isn't very standard either. And EURid uses a similar format.
match = re.search("Registrar:\n\s+(?:Name:\s*)?(\S.*)", segment)
if match is not None:
data["registrar"].insert(0, match.group(1).strip())
try:
data["registrar"].insert(0, match.group(1).strip())
except KeyError as e:
data["registrar"] = [match.group(1).strip()]
match = re.search("(?:Domain nameservers|Name servers):([\s\S]*?\n)\n", segment)
if match is not None:
chunk = match.group(1)
for match in re.findall("\s+?(.+)\n", chunk):
match = match.split()[0]
# Prevent nameserver aliases from being picked up.
try:
match = match.split()[0]
#prevents a crash in the case that chunk contains a blank string entry
except IndexError:
match = "[]"
#Prevent nameserver aliases from being picked up.
if not match.startswith("[") and not match.endswith("]"):
try:
data["nameservers"].append(match.strip())
Expand Down Expand Up @@ -803,7 +810,7 @@ def parse_dates(dates):
second = 0
print(e.message) # FIXME: This should have proper logging of some sort...?
try:
if year > 0:
if year > 0 and (year == 2000 and month > 0):
try:
parsed_dates.append(datetime.datetime(year, month, day, hour, minute, second))
except ValueError as e:
Expand Down