Metadata-Version: 2.1
Name: ip-country
Version: 1.0.0
Summary: An offline tool to get country by IP
Home-page: https://github.com/dmitriiweb/ip-country
Author: Dmitrii K
Author-email: winston.smith.spb@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: pandas (>=0.25.0)

ip-country
==========

An offline tool to get country by IP

Requirements
------------

-  Python >= 3.6
-  IP2Location™ LITE IP-COUNTRY-REGION-CITY Database

Installation
------------

1. Download IP2Location database for IPv4 from
   `https://lite.ip2location.com/database/ip-country-region-city <here>`__

2. Install library:

``pip install ip_country``

Usage
-----

::

    >>> from pprint import pprint
    >>> from ip_country import IPCountry
    >>> ip = IPCountry('/path/to/ipdb.csv')
    >>> ip_data = ip.get_ip_data('13.73.96.0')
    >>> pprint(ip_data)
    {'city_name': 'Melbourne',
     'country_code': 'AU',
     'country_name': 'Australia',
     'error': None,
     'ip': '13.73.96.0',
     'region_name': 'Victoria'}

    >>> ip_data = ip.get_ip_data('blah.73.96.0')
    >>> pprint(ip_data)
    {'error': "Only decimal digits permitted in 'blah' in 'blah.73.96.0'",
     'ip': 'blah.73.96.0'}



