Skip to content
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

library fails parsing .ca domains #145

Open
skjortan23 opened this issue Nov 5, 2018 · 3 comments
Open

library fails parsing .ca domains #145

skjortan23 opened this issue Nov 5, 2018 · 3 comments

Comments

@skjortan23
Copy link

When performing a whois for Canadian domains the library crashes with a KeyError.

to reproduce.
import pythonwhois res = pythonwhois.get_whois('cns.ca')

error:
Traceback (most recent call last): File "/Users/skjortan/intelliagg/test_pythonwhois.py", line 3, in <module> res = pythonwhois.get_whois('cns.ca') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pythonwhois/__init__.py", line 8, in get_whois return parse.parse_raw_whois(raw_data, normalized=normalized, never_query_handles=False, handle_server=server_list[-1]) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pythonwhois/parse.py", line 516, in parse_raw_whois data["registrar"].insert(0, match.group(1).strip()) KeyError: 'registrar'

@skjortan23
Copy link
Author

The following code I hacked together to be able to parse .ca domains
It works but its not pretty.

in parse.py
else: match = re.search("Registrar:\n\s+Name:(.+)", segment) if match is not None: data["registrar"] = [match.group(1).strip()]

@raeq
Copy link

raeq commented Nov 15, 2018

@skjortan23
Copy link
Author

Hm would be nice if the maintainer of the core library @joepie91 could pull the fixes in the fork. There are fixes for this. Or let me know if you want me to make a pull request with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants