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 rdap keys #65

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Fix mismatched rdap keys #65

merged 5 commits into from
Oct 12, 2023

Conversation

pogzyb
Copy link
Owner

@pogzyb pogzyb commented Oct 12, 2023

@pogzyb pogzyb self-assigned this Oct 12, 2023
@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (9dc7ad0) 88.62% compared to head (7b3260d) 85.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   88.62%   85.84%   -2.78%     
==========================================
  Files           8        8              
  Lines        2821     2960     +139     
==========================================
+ Hits         2500     2541      +41     
- Misses        321      419      +98     
Files Coverage Δ
asyncwhois/parse_rir.py 31.73% <ø> (ø)
asyncwhois/query.py 78.43% <100.00%> (ø)
asyncwhois/parse.py 94.41% <92.85%> (-0.17%) ⬇️
asyncwhois/pywhois.py 44.66% <50.00%> (+1.93%) ⬆️
asyncwhois/parse_tld.py 76.58% <74.07%> (-13.12%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pogzyb pogzyb merged commit edc88d9 into main Oct 12, 2023
30 of 32 checks passed
@pogzyb pogzyb deleted the fix-mismatched-rdap-keys branch October 12, 2023 17:11
@y-polyakov-ddl
Copy link

This actually broke the functionality, advertised in the main README: both rdap methods now return None for bitcoin.org registrar.
Reason:

def convert_whodap_keys(parser_output: dict) -> dict:
    conversions = [  # snip
        (TLDBaseKeys.REGISTRAR, "registrar_name", False),  # 'registrar'
    ]
    for asyncwhois_key, whodap_key, keep in conversions:
        if keep:
            parser_output[asyncwhois_key] = parser_output.get(whodap_key)
        else:
            parser_output[asyncwhois_key] = parser_output.pop(whodap_key)

    # at this point, parser_output['registrar'] is the registrar name

    non_whodap_keys = [
       TLDBaseKeys.REGISTRAR,  # also 'registrar'
    ]
    for key in non_whodap_keys:
        parser_output[key] = None  # overwrites any value present in parser_output

   # at this point, parser_output['registrar'] is None

The easiest fix would probably be to remove this key, present in conversions, from non_whodap_keys.

This was referenced Jun 16, 2024
@pogzyb
Copy link
Owner Author

pogzyb commented Jun 16, 2024

This actually broke the functionality, advertised in the main README: both rdap methods now return None for bitcoin.org registrar. Reason:

def convert_whodap_keys(parser_output: dict) -> dict:
    conversions = [  # snip
        (TLDBaseKeys.REGISTRAR, "registrar_name", False),  # 'registrar'
    ]
    for asyncwhois_key, whodap_key, keep in conversions:
        if keep:
            parser_output[asyncwhois_key] = parser_output.get(whodap_key)
        else:
            parser_output[asyncwhois_key] = parser_output.pop(whodap_key)

    # at this point, parser_output['registrar'] is the registrar name

    non_whodap_keys = [
       TLDBaseKeys.REGISTRAR,  # also 'registrar'
    ]
    for key in non_whodap_keys:
        parser_output[key] = None  # overwrites any value present in parser_output

   # at this point, parser_output['registrar'] is None

The easiest fix would probably be to remove this key, present in conversions, from non_whodap_keys.

Thanks for pointing this out! I added your suggestion and rolled it into v1.1.4.

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

Successfully merging this pull request may close these issues.

2 participants