0

I'm running whois.whois on Python 3.5 as follows:

def simpleWhois(url):
    try:
        result = whois.whois(url)
        return result
    except Exception as error:
        print(type(error), error, url)
        return pd.Series.empty

On most URLs e.g. 'google.com' I get a Pandas Series, but on some example like 'www.usaa-a.com' an error is raised, and I get a <property object at 0x00000000XXXX>, Name: whois, dtype: object. Whose properties are they? How can I get to them? How can I test test that I'm getting this kind of result rather than a series, and perhaps overwrite it with an empty series if I can't get anything useful out of it? Thanks!

ayhan
  • 70,170
  • 20
  • 182
  • 203
carmi
  • 75
  • 1
  • 4
  • `google.com` is a domain name, for which you can use `whois`, while `www.usaaa.com` is an hostname. In the second case try instead with just `usaaa.com` only. – Patrick Mevzek Jan 02 '18 at 16:51

1 Answers1

0

I still don't understand why I got a property object, but for this particular problem I came up with the following solution:

    def simpleWhois(url):
try:
    result = whois.whois(url)
    return result
except:
    error = sys.exc_info()[0]
    print("Error: %s, %s, for %s " % (type(error), error, url))
    return whois.parser.WhoisEntry.load(url, '')

i.e. return an empty whois entry.

carmi
  • 75
  • 1
  • 4