Skip to main content

2ip.me API Client.

Project description

Python 2ip Module

2ip allows you to make requests to the 2ip.me API to retrieve provider/geographic information for IP addresses. Requests are (optionally, on by default) cached to prevent unnecessary API lookups when possible.

Examples

Retrieve provider information for the IP address 192.0.2.0:

>>> from twoip import TwoIP
>>> twoip = TwoIP(key = None)
>>> twoip.provider(ip = '192.0.2.0')
{'ip': '192.0.2.0',
 'ip_range_end': '3221226239',
 'ip_range_start': '3221225984',
 'mask': '24',
 'name_ripe': 'Reserved AS',
 'name_rus': '',
 'route': '192.0.2.0'}

Retrieve geographic information for the IP address 8.8.8.8:

>>> from twoip import TwoIP
>>> twoip = TwoIP(key = None)
>>> twoip.geo(ip = '8.8.8.8')
{'city': 'Mountain view',
 'country': 'United states of america',
 'country_code': 'US',
 'country_rus': 'США',
 'country_ua': 'США',
 'ip': '8.8.8.8',
 'latitude': '37.405992',
 'longitude': '-122.078515',
 'region': 'California',
 'region_rus': 'Калифорния',
 'region_ua': 'Каліфорнія',
 'time_zone': '-08:00',
 'zip_code': '94043'}

Roadmap/Todo

  • <input type="checkbox" disabled="" /> Support for email API
  • <input type="checkbox" disabled="" /> Support for MAC address API
  • <input type="checkbox" disabled="" /> Support for hosting API
  • <input type="checkbox" disabled="" /> Option to retrieve data as XML
  • <input type="checkbox" disabled="" /> Unit tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for 2ip, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size 2ip-0.0.1-py2.py3-none-any.whl (5.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size 2ip-0.0.1-py3.8.egg (10.6 kB) File type Egg Python version 3.8 Upload date Hashes View
Filename, size 2ip-0.0.1.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page