Skip to content

Commit

Permalink
Merge pull request #164 from secynic/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
secynic authored Feb 17, 2017
2 parents 6616baf + b00f174 commit 917b6b5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 11 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Changelog
=========

0.15.1 (TBD)
------------
0.15.1 (2017-02-16)
-------------------

- Fixed IPv6 parsing for ASN origin lookups and added tests (#162 - ti-mo)
- Fixed recursive role parsing at depths greater than 0 (#161 - cdubz)

0.15.0 (2017-02-02)
-------------------
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ipwhois
:target: https://github.com/secynic/ipwhois/tree/master/LICENSE.txt
.. image:: https://img.shields.io/badge/python-2.6%2C%202.7%2C%203.3+-blue.svg
:target: https://docs.python.org
.. image:: https://img.shields.io/badge/docs-release%20v0.15.0-green.svg?style=flat
:target: https://ipwhois.readthedocs.io/en/v0.15.0
.. image:: https://img.shields.io/badge/docs-release%20v0.15.1-green.svg?style=flat
:target: https://ipwhois.readthedocs.io/en/v0.15.1
.. image:: https://readthedocs.org/projects/pip/badge/?version=latest
:target: https://ipwhois.readthedocs.io/en/latest
.. image:: https://img.shields.io/badge/docs-dev-yellow.svg?style=flat
Expand All @@ -39,7 +39,7 @@ for IPv4 and IPv6 addresses.

RDAP (IPWhois.lookup_rdap()) is the recommended query method as of v0.11.0.
If you are upgrading from earlier than 0.11.0, please see the
`upgrade info <https://ipwhois.readthedocs.io/en/v0.15.0/RDAP.html
`upgrade info <https://ipwhois.readthedocs.io/en/v0.15.1/RDAP.html
#upgrading-from-0-10-to-0-11>`_.

.. note::
Expand Down Expand Up @@ -77,10 +77,10 @@ Links
Documentation
-------------

Release v0.15.0
Release v0.15.1
^^^^^^^^^^^^^^^

https://ipwhois.readthedocs.io/en/v0.15.0
https://ipwhois.readthedocs.io/en/v0.15.1

GitHub master
^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion ipwhois/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

__version__ = '0.15.0'
__version__ = '0.15.1'

from .exceptions import *
from .net import Net
Expand Down
4 changes: 2 additions & 2 deletions ipwhois/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
# built documents.
#
# The short X.Y version.
version = '0.15.0'
version = '0.15.1'
# The full version, including alpha/beta/rc tags.
release = '0.15.0'
release = '0.15.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
32 changes: 32 additions & 0 deletions ipwhois/rdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ def lookup(self, inc_raw=False, retry_count=3, asn_data=None, depth=0,
results['network'] = result_net.vars
results['entities'] = []
results['objects'] = {}
roles = {}

# Iterate through and parse the root level entities.
log.debug('Parsing RDAP root level entities')
Expand All @@ -764,6 +765,16 @@ def lookup(self, inc_raw=False, retry_count=3, asn_data=None, depth=0,

results['entities'].append(ent['handle'])

try:

for tmp in ent['entities']:

roles[tmp['handle']] = tmp['roles']

except KeyError:

pass

except KeyError:

pass
Expand Down Expand Up @@ -811,6 +822,27 @@ def lookup(self, inc_raw=False, retry_count=3, asn_data=None, depth=0,
result_ent.parse()
new_objects[ent] = result_ent.vars

new_objects[ent]['roles'] = None
try:

new_objects[ent]['roles'] = roles[ent]

except KeyError: # pragma: no cover

pass

try:

for tmp in response['entities']:

if tmp['handle'] not in roles:

roles[tmp['handle']] = tmp['roles']

except (IndexError, KeyError):

pass

if inc_raw:

new_objects[ent]['raw'] = response
Expand Down
14 changes: 14 additions & 0 deletions ipwhois/tests/test_rdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ def test__RDAPLookup(self):
bootstrap=True,
inc_raw=True), dict)

# No sub entities. This is for coverage, but won't error out.
entity = [{'handle': 'test', 'roles': [
'administrative', 'technical']}]

self.assertIsInstance(obj.lookup(response={
'handle': 'test',
'ipVersion': 'v4',
'startAddress': '74.125.225.229',
'endAddress': '74.125.225.229',
'entities': entity
},
asn_data=val['asn_data'],
depth=1), dict)


class TestRDAPContact(TestCommon):

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io

NAME = 'ipwhois'
VERSION = '0.15.0'
VERSION = '0.15.1'
AUTHOR = 'Philip Hane'
AUTHOR_EMAIL = 'secynic AT gmail DOT com'
DESCRIPTION = 'Retrieve and parse whois data for IPv4 and IPv6 addresses.'
Expand Down

0 comments on commit 917b6b5

Please sign in to comment.