meeb / whoisit

A Python library to RDAP WHOIS-like services for internet resources such as ASNs, IPs, CIDRs and domains
BSD 3-Clause "New" or "Revised" License
78 stars 20 forks source link

Feature Request: Add support for unicodeName #27

Closed Zalaxx closed 5 months ago

Zalaxx commented 5 months ago

Domains with unicode characters have an additional field named unicodeName, which contains their name nicely formatted. It would be great to be able to parse it automatically, so that we can retrieve it easily if needed!

Example of such domain: château-de-la-branchoire.net (xn--chteau-de-la-branchoire-j6b.net) Corresponding RDAP query: https://rdap.nameshield.net/domain/xn--chteau-de-la-branchoire-j6b.net And here is the RFC regarding this field: https://www.rfc-editor.org/rfc/rfc9083.html#section-5.2-14.4

Some RDAP servers also seems to have both field even if there is no unicode characters (ex: https://rdap.publicinterestregistry.org/rdap/domain/kernel.org).

meeb commented 5 months ago

A nice idea, thanks. That field has been added after I originally wrote the domain data parser which is why it was originally missing. The above commit adds it and this will be bundled into the next release.

Zalaxx commented 5 months ago

Wow thanks that was quick! <3 Any idea when the next release will be?

meeb commented 5 months ago

I'll push a release shortly, just tweaking some other parser stuff.

meeb commented 5 months ago

v2.7.5 has just been pushed and contains the above patch. Both punycoded and unicoded domains should now be handled for both queries and in the output data:

>>> import whoisit
>>> whoisit.version
'2.7.5'
>>> whoisit.bootstrap()
True
>>> whoisit.domain('xn--chteau-de-la-branchoire-j6b.net')['unicode_name']
'château-de-la-branchoire.net'
>>> whoisit.domain('château-de-la-branchoire.net')['unicode_name']
'château-de-la-branchoire.net'

For anyone else who stumbles over this, 2.7.5 also resolves an issue with subrequested RDAP data overwriting required root RDAP server data which caused some domain lookups to fail. Introduced in 2.7.4, upgrade to 2.7.5 to fix it.