Skip to content

Commit

Permalink
Fixed parsing bug in ASN HTTP lookup (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
secynic committed Jan 29, 2019
1 parent f836c31 commit 87642bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

1.1.0 (TBD)
-----------

- Exceptions now inherit a new BaseIpwhoisException rather than Exception
(#205 - Darkheir)
- Fixed list output for generate_examples.py (#196)
- Fixed bug in ASN HTTP lookup where the ARIN results were reversed, and
parsing would fail on the first item (#220)

1.0.0 (2017-07-30)
------------------

Expand Down
9 changes: 7 additions & 2 deletions ipwhois/asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def parse_fields_http(self, response, extra_org_map=None):
log.debug('No networks found')
net_list = []

for n in net_list:
for n in reversed(net_list):

try:

Expand All @@ -383,10 +383,15 @@ def parse_fields_http(self, response, extra_org_map=None):

log.debug('Could not parse ASN registry via HTTP: '
'{0}'.format(str(e)))
raise ASNRegistryError('ASN registry lookup failed.')
continue

break

if not asn_data['asn_registry']:

log.debug('Could not parse ASN registry via HTTP')
raise ASNRegistryError('ASN registry lookup failed.')

except ASNRegistryError:

raise
Expand Down
3 changes: 2 additions & 1 deletion ipwhois/tests/test_asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def test__parse_fields_http(self):

data = ''
try:
self.assertIsInstance(ipasn._parse_fields_http(response=data), dict)
self.assertRaises(ASNRegistryError, ipasn._parse_fields_http,
response=data)
except AssertionError as e:
raise e
except Exception as e:
Expand Down

0 comments on commit 87642bd

Please sign in to comment.