Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed parsing bug in ASN HTTP lookup (#220) #222

Merged
merged 1 commit into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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