Python IP Query.


Keywords
IP, address, GEO
License
MIT
Install
pip install ip-query==4.3.1

Documentation

Python: IP Query

PyPi Version

IP Query, allow proxy.

Installation

$ pip3 install ip-query

Usage

from ip_query import ip_query

ip = ip_query()

you will get the result like this:

{
    'ip': '112.118.6.224',
    'country': 'Hong Kong',
    'country_code': 'HK',
    'asn': 4760,
    'aso': 'HKT Limited'
}

Behind a socks5 proxy? use like this:

from ip_query import ip_query

ip = ip_query(
    requests_proxies={
        'http': 'socks5://127.0.0.1:1080',
        'https': 'socks5://127.0.0.1:1080',
    },
)

Thanks

We've chosen GeoLite2 Country and GeoLite2 ASN from GeoLite2 Free Downloadable Databases..

Latest Version: 20190312.

Many thanks to MaxMind.