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
Allow to queries IP prefixes #253
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix 2.7 build
ipwhois/tests/test_net.py
Outdated
|
||
self.assertRaises(IPDefinedError, Net, '192.168.0.1') | ||
self.assertRaises(IPDefinedError, Net, 'fe80::') | ||
self.assertRaises(IPDefinedError, Net, IPv4Address('192.168.0.1')) | ||
self.assertRaises(IPDefinedError, Net, IPv6Address('fe80::')) | ||
self.assertRaises(IPDefinedError, Net, '192.168.0.0/16') | ||
self.assertRaises(IPDefinedError, Net, 'fe80::/10') | ||
self.assertRaises(IPDefinedError, Net, IPv4Network('192.168.0.0/16')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not building on Python 2.7. I think it has to do with your addition of unicode() which seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that, the problem was that the test used ipaddr.IPv4Network but now the net.py code check for ipaddress.IPv4Network. ipaddr has been superseded by ipaddress for both python3 and python2. It might be better to replace all the instances of ipaddr to ipaddress across all the files?
@romain-fontugne Still not building for 2.7. ipaddress is not built in on Python 2.7 |
@romain-fontugne Actually, after I have reviewed this, I don't see the point in this if it only uses the first address in a range. Can you explain why this is needed? |
@secynic sorry, I haven't take the time to look at that. Only the is_defined check is done with the first IP in the range. The query is done with the prefix. Prefix 1.2.0.0/16 and 1.2.0.0/24 have the same first IP but could have different whois info. |
I could really make use of this feature too. |
Hey Alistair, |
This allows to query an IP prefix, for example 8.8.8.0/24 or 8.0.0.0/9
The is_defined check is done with the first IP in the range.
fixes #250