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

Fix mismatched keys in rdap and whois methods #64

Closed
pogzyb opened this issue Oct 4, 2023 · 0 comments
Closed

Fix mismatched keys in rdap and whois methods #64

pogzyb opened this issue Oct 4, 2023 · 0 comments

Comments

@pogzyb
Copy link
Owner

pogzyb commented Oct 4, 2023

The rdap_domain method uses whodap's to_whois_dict method behind the scenes. This library returns slightly different keys for the whois dictionary that asyncwhois does not.

For example:

import asyncwhois

w = asyncwhois.whois_domain("google.com")
r = asyncwhois.rdap_domain("google.com")

w_keys = w.parser_output.keys()
r_keys = r.parser_output.keys()

# see mismatches
print([k for k in r_keys if k not in w_keys])
print([k for k in w_keys if k not in r_keys])

The task is to write a static function in the DomainLookup class:

@staticmethod
def _convert_whodap_keys(parser_output: dict) -> dict:
    # handle mismatched keys
    return parser_output

The above function should be used in the rdap_domain and aio_rdap_domain functions of DomainLookup

whois_dict = response.to_whois_dict()
_self._parser = _self._convert_whodap_keys(whois_dict)
return _self
This was referenced Oct 12, 2023
@pogzyb pogzyb closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant