Skip to content

Commit

Permalink
Merge pull request #268 from Misiu/fix-readme
Browse files Browse the repository at this point in the history
fix example in readme + WhoisUnknownDateFormatError test
  • Loading branch information
richardpenman authored Jan 28, 2025
2 parents b3e0122 + 1d93e18 commit 96360e4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ class WhoisOrg(WhoisEntry):
if text.strip() == 'NOT FOUND':
raise WhoisDomainNotFoundError(text)
else:
WhoisEntry.__init__(self, domain, text)
WhoisEntry.__init__(self, domain, text, self.regex)
```
1 change: 1 addition & 0 deletions test/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8

import unittest

from whois import extract_domain


Expand Down
1 change: 1 addition & 0 deletions test/test_nicclient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8

import unittest

from whois.whois import NICClient


Expand Down
13 changes: 10 additions & 3 deletions test/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# -*- coding: utf-8 -*-

import os
import datetime
import json
from glob import glob
import os
import unittest
from glob import glob

from whois.exceptions import WhoisUnknownDateFormatError
from whois.parser import (
WhoisCa,
WhoisEntry,
cast_date,
WhoisCa,
datetime_parse,
)


Expand All @@ -32,6 +35,10 @@ def test_cast_date(self):
r = cast_date(d).strftime("%Y-%m-%d")
self.assertEqual(r, "2008-04-14")

def test_unknown_date_format(self):
with self.assertRaises(WhoisUnknownDateFormatError):
datetime_parse("UNKNOWN")

def test_com_allsamples(self):
"""
Iterate over all of the sample/whois/*.com files, read the data,
Expand Down
1 change: 1 addition & 0 deletions test/test_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8

import unittest

from whois import whois


Expand Down
1 change: 0 additions & 1 deletion whois/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from .parser import WhoisEntry
from .whois import NICClient


logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
Expand Down
3 changes: 2 additions & 1 deletion whois/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import json
import re
from datetime import datetime
import dateutil.parser as dp
from typing import Any, Callable, Optional, Union

import dateutil.parser as dp
from dateutil.utils import default_tzinfo

from .exceptions import WhoisDomainNotFoundError, WhoisUnknownDateFormatError
Expand Down
2 changes: 1 addition & 1 deletion whois/whois.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"""

import logging
import os
import optparse
import os
import re
import socket
import sys
Expand Down

0 comments on commit 96360e4

Please sign in to comment.