Opened 10 years ago

Closed 9 years ago

#44587 closed submission (fixed)

New port: py-ipwhois

Reported by: gorticus (Jason Mitchell) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: py-ipwhois Cc: petrrr, kurthindenburg (Kurt Hindenburg)
Port: py-ipwhois

Description

Summary

ipwhois (py-ipwhois) is a simple package for retrieving and parsing whois data for IPv4 and IPv6 addresses.

Features

  • Parses a majority of whois fields in to a standard dictionary
  • IPv4 and IPv6 support
  • Supports REST queries (useful if whois is blocked from your network)
  • Proxy support for REST queries
  • Recursive network parsing for IPs with parent/children networks listed
  • Python 2.6+ and 3.3+ supported
  • Useful set of utilities
  • BSD license

Example

>> from ipwhois import IPWhois
>> from pprint import pprint

>> obj = IPWhois('74.125.225.229')
>> results = obj.lookup()
>> pprint(results)

{
'asn': '15169',
'asn_cidr': '74.125.225.0/24',
'asn_country_code': 'US',
'asn_date': '2007-03-13',
'asn_registry': 'arin',
'nets': [{'abuse_emails': 'arin-contact@google.com',
          'address': '1600 Amphitheatre Parkway',
          'cidr': '74.125.0.0/16',
          'city': 'Mountain View',
          'country': 'US',
          'created': '2007-03-13T00:00:00',
          'description': 'Google Inc.',
          'handle': 'NET-74-125-0-0-1',
          'misc_emails': None,
          'name': 'GOOGLE',
          'postal_code': '94043',
          'range': '74.125.0.0 - 74.125.255.255',
          'state': 'CA',
          'tech_emails': 'arin-contact@google.com',
          'updated': '2012-02-24T00:00:00'}],
'query': '74.125.225.229',
'raw': None,
'raw_referral': None,
'referral': None
}

Attachments (1)

Portfile (1.1 KB) - added by gorticus (Jason Mitchell) 9 years ago.
updated portfile based on feedback from other portfile submissions

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by petrrr

Cc: petr@… added

Cc Me!

comment:2 Changed 9 years ago by kurthindenburg (Kurt Hindenburg)

Cc: khindenburg@… added

Cc Me!

comment:3 Changed 9 years ago by kurthindenburg (Kurt Hindenburg)

I made a few small adjustments to your Portfile - however, does it work for you?

w/ python27 I get

ImportError: cannot import name IPWhois

comment:4 Changed 9 years ago by gorticus (Jason Mitchell)

IPWhois is the object, ipwhois is the namespace, as in the description example, e.g.,

$ python
>>> import socket, ipwhois
>>> fqdn = 'www.macports.org'
>>> ip = socket.gethostbyname(fqdn)
>>> ip
'17.251.224.214'
>>> w = ipwhois.IPWhois(ip)
>>> w.lookup()
{'asn': '714',
 'asn_cidr': '17.251.0.0/16',
 'asn_country_code': 'US',
 'asn_date': '',
 'asn_registry': 'arin',
 'nets': [{'abuse_emails': 'abuse@apple.com',
   'address': '20400 Stevens Creek Blvd., City Center Bldg 3',
   'cidr': '17.0.0.0/8',
   'city': 'Cupertino',
   'country': 'US',
   'created': '1990-04-16T00:00:00',
   'description': 'Apple Inc.',
   'handle': 'NET-17-0-0-0-1',
   'misc_emails': None,
   'name': 'APPLE-WWNET',
   'postal_code': '95014',
   'range': '17.0.0.0 - 17.255.255.255',
   'state': 'CA',
   'tech_emails': 'droot@apple.com',
   'updated': '2012-04-02T00:00:00'}],
 'query': '17.251.224.214',
 'raw': None,
 'raw_referral': None,
 'referral': None}

Works just fine for me: as above, so below.

Changed 9 years ago by gorticus (Jason Mitchell)

Attachment: Portfile added

updated portfile based on feedback from other portfile submissions

comment:5 Changed 9 years ago by gorticus (Jason Mitchell)

In updated Portfile

  • removed fetch.type
    • removed related depends_fetch-append bin:git:git
  • removed revision
  • added checksums
  • added livecheck none
  • only subports for 27 34
Last edited 9 years ago by gorticus (Jason Mitchell) (previous) (diff)

comment:6 Changed 9 years ago by petrrr

Committed in r132166.

comment:7 Changed 9 years ago by petrrr

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.