Skip to content

Commit

Permalink
0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
secynic committed Sep 17, 2013
1 parent c3d4681 commit eb4b77a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Changelog
0.1.8 (2013-09-17)
------------------

- Removed set_proxy() in favor of having the user provide their own urllib.request.OpenerDirector instance as a parameter to IPWhois()
- Restructured package in favor of modularity.
- Removed set_proxy() in favor of having the user provide their own urllib.request.OpenerDirector instance as a parameter to IPWhois().
- Restructured package in favor of modularity. get_countries() is now located in ipwhois.utils.
- Added exception WhoisLookupError for IPWhois.lookup() and IPWhois.lookup_rws().

0.1.7 (2013-09-16)
------------------
Expand Down
15 changes: 14 additions & 1 deletion ipwhois/ipwhois.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ class ASNLookupError(Exception):
"""
An Exception for when the ASN lookup failed.
"""


class WhoisLookupError(Exception):
"""
An Exception for when the Whois lookup failed.
"""

class IPWhois():
"""
The class for performing ASN/whois lookups and parsing for IPv4 and IPv6 addresses.
Expand Down Expand Up @@ -486,6 +491,10 @@ def lookup(self, inc_raw = False):
#Retrieve the whois data.
response = self.get_whois(results['asn_registry'])

if not response:

raise WhoisLookupError('Whois lookup failed for %r.' % self.address_str)

#If the inc_raw parameter is True, add the response to the return dictionary.
if inc_raw:

Expand Down Expand Up @@ -698,6 +707,10 @@ def lookup_rws(self, inc_raw = False):
if not response:

response = self.get_rws('http://apps.db.ripe.net/whois/grs-search?query-string={0}&source=radb-grs'.format(self.address_str))

if not response:

raise WhoisLookupError('Whois RWS lookup failed for %r.' % self.address_str)

#If the inc_raw parameter is True, add the response to the return dictionary.
if inc_raw:
Expand Down

0 comments on commit eb4b77a

Please sign in to comment.