richardpenman / whois

MIT License
368 stars 187 forks source link

Fixed .jp updated_date domain_name and name_servers #214

Closed wakaka6 closed 4 months ago

wakaka6 commented 5 months ago

whois server return

[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
Domain Information: [ドメイン情報]
a. [ドメイン名]                 YAHOO.CO.JP
e. [そしきめい]                 らいんやふーかぶしきがいしゃ
f. [組織名]                     LINEヤフー株式会社
g. [Organization]               LY Corporation
k. [組織種別]                   株式会社
l. [Organization Type]          Corporation
m. [登録担当者]                 HT57990JP
n. [技術連絡担当者]             YY47022JP
p. [ネームサーバ]               ns01.yahoo.co.jp
p. [ネームサーバ]               ns02.yahoo.co.jp
p. [ネームサーバ]               ns11.yahoo.co.jp
p. [ネームサーバ]               ns12.yahoo.co.jp
s. [署名鍵]
[状態]                          Connected (2024/09/30)
[ロック状態]                    AgentChangeLocked
[登録年月日]                    2019/09/27
[接続年月日]                    2019/09/27
[最終更新]                      2023/11/24 15:13:45 (JST)

fixed before

In [1]: import whois

In [2]: whois.whois("yahoo.co.jp")
Out[2]:
{'domain_name': None,
 'registrant_org': 'LY Corporation',
 'creation_date': datetime.datetime(2019, 9, 27, 0, 0),
 'expiration_date': None,
 'name_servers': None,
 'updated_date': '2023/11/24 15:13:45 (JST)',
 'status': 'Connected (2024/09/30)'}

fixed after

In [1]: import whois

In [2]: whois.whois("yahoo.co.jp")
Out[2]:
{'domain_name': 'YAHOO.CO.JP',
 'registrant_org': 'LY Corporation',
 'creation_date': datetime.datetime(2019, 9, 27, 0, 0, tzinfo=datetime.timezone.utc),
 'expiration_date': None,
 'name_servers': ['ns01.yahoo.co.jp',
  'ns02.yahoo.co.jp',
  'ns11.yahoo.co.jp',
  'ns12.yahoo.co.jp'],
 'updated_date': datetime.datetime(2023, 11, 24, 15, 13, 45, tzinfo=tzoffset('JST', 32400)),
 'status': 'Connected (2024/09/30)'}
richardpenman commented 5 months ago

Thanks for PR! Looks like some tests are failing: https://github.com/richardpenman/whois/actions/runs/8846370438/job/24292113782?pr=214

richardpenman commented 5 months ago

The tests don't use live data and the parser will need to be updated to reflect your format changes.

wakaka6 commented 5 months ago

image I've resolved the exception related to using datetime.UTC, which resulted in the parsed data incorporating timezone information. I believe preserving the timezone data within the time stamps is beneficial to prevent potential time-associated errors in a global application context.

image

Actually, this chunk of the code will never run. image image

richardpenman commented 4 months ago

Unfortunately the tests are still failing. You can run tests locally with python -m pytest to see what needs fixing.

wakaka6 commented 4 months ago

Unfortunately the tests are still failing. You can run tests locally with python -m pytest to see what needs fixing.

Hey bro, can you tell me why your test cases come with time zone information one time and not the other, I can understand that you use the test used to make sure that the program is correct, but without learning that I have no motivation to fix this tests error as it works fine in my environment.

richardpenman commented 4 months ago

You’ll need to figure it out. These tests are contributed by multiple people over time.

If you’re not motivated that’s fine, I’ll close the PR.

On Mon, May 20, 2024 at 3:57 PM wakaka6 @.***> wrote:

Unfortunately the tests are still failing. You can run tests locally with python -m pytest to see what needs fixing.

Hey bro, can you tell me why your test cases come with time zone information one time and not the other, I can understand that you use the test used to make sure that the program is correct, but without learning that I have no motivation to fix this tests error as it works fine in my environment.

— Reply to this email directly, view it on GitHub https://github.com/richardpenman/whois/pull/214#issuecomment-2119885392, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGG3CKWEAFBRX3TZIFVX3MTZDGUF3AVCNFSM6AAAAABG2O3CJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZHA4DKMZZGI . You are receiving this because you commented.Message ID: @.***>

mzpqnxow commented 3 months ago

There is an issue with using datetime.UTC that causes a silent failure

I believe this is because of a NameError, caused by datetime.UTC only being supported on some Python 3 versions

I will send a PR to fix it later today, the issue may have been a symptom of this