Skip to main content

Official python package for apiip.net, it offers one of the leading IP to geolocation API, get the location of any IP with a world-class API serving city, region, country, lat/long data, etc.

Project description

IP to Location

Find geolocation data from IP addresses (e.g. city, country, lat/long) using the apiip.net API.

apiip.net provides 1.000 free requests per month. For higher plans, check out the website

Installation

You need to get your API key from here: https://apiip.net/get-started and you'll get 1.000 free requests/month

For more details, please visit: API Documentation

To install this package type the following (for PyPI):

pip install apiip

Usage

The package needs to be configured with your account's API key, which is available in the apiip.net Dashboard

from apiip import apiip

api_client = apiip('YOUR_API_KEY')

info = api_client.get_location()

print(info)

HTTPS Encryption

By default, the SSL/TLS is turned on, if you want to disable it just pass the options parameter

Example

from apiip import apiip

api_client = apiip('YOUR_API_KEY', {'ssl': False})

info = api_client.get_location()

print(info)

Configuration

Call getLocation method with config object

from apiip import apiip

api_client = apiip('YOUR_API_KEY')

info = api_client.getLocation({
    'ip': "67.250.186.196", # '67.250.186.196, 188.79.34.191, 60.138.7.24' - for bulk request
    'output': "xml",
    'fields': "city, countryName, currency.name",
    'languages': "es",
})

print(info)
Option Type Description Default
ip string Optional. Get location about the specify IP or multiple IPs. Requester IP
output string Optional. Specify response format, XML or JSON. JSON
fields string Optional. Specify response fields. All fields
languages string Optional. Specify response language. EN
callback string Optional. The callback function name (JSONP Callbacks) -

Example complete response

{
  "ip": "67.250.186.196",
  "continentCode": "NA",
  "continentName": "North America",
  "countryCode": "US",
  "countryName": "United States",
  "countryNameNative": "United States",
  "regionCode":"NY"
  "regionName":"New York"
  "cityGeoNameId": 5128581,
  "city": "New York",
  "postalCode": "10001",
  "latitude": 40.8271,
  "longitude": -73.9359,
  "capital": "Washington D.C.",
  "phoneCode": "1",
  "countryFlagEmoj": "🇺🇸",
  "countryFlagEmojUnicode": "U+1F1FA U+1F1F8",
  "isEu": False,
  "borders": [
    "CAN",
    "MEX"
  ],
  "topLevelDomains": [
    ".us"
  ],
  "languages": {
    "en": {
      "code": "en",
      "name": "English",
      "native": "English"
    }
  },
  "currency": {
    "code": "USD",
    "name": "US Dollar",
    "symbol": "$",
    "number": "840",
    "rates": {
      "EURUSD": 0.99518
    }
  },
  "timeZone": {
    "id": "America/New_York",
    "currentTime": "10/26/2021, 2:54:10 PM",
    "code": "EDT",
    "timeZoneName": "EDT",
    "utcOffset": -14400
  },
   "userAgent": {
    "isMobile": False,
    "isiPod": False,
    "isTablet": False,
    "isDesktop": True,
    "isSmartTV": False,
    "isRaspberry": False,
    "isBot": False,
    "browser": "Chrome",
    "browserVersion": "100.0.4896.127",
    "operatingSystem": "Windows 10.0",
    "platform": "Microsoft Windows",
    "source": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
  },
  "connection": {
    "asn": 12271,
    "isp": "Charter Communications Inc"
  },
  "security": {
    "isProxy": False,
    "isBogon": False,
    "isTorExitNode": False,
    "isCloud": False,
    "isHosting": False,
    "isSpamhaus": False,
    "suggestion": "allow",
    "network": "67.250.176.0/20"
  }
}

More Information

Project details


Download files

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

Source Distribution

apiip-1.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

apiip-1.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file apiip-1.2.0.tar.gz.

File metadata

  • Download URL: apiip-1.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for apiip-1.2.0.tar.gz
Algorithm Hash digest
SHA256 f3b94defcedea3f99d0b02cc0647cf34d4202e47dbc881ad111899f265ad6c53
MD5 7e32597ecfc69589d4a3532142cb0bef
BLAKE2b-256 4e6a95008486d3bfa2b6bf3a8a2791491a88392722ce144dee436871c468e71e

See more details on using hashes here.

File details

Details for the file apiip-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: apiip-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for apiip-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82dd1dba69bec469c193f3bea3c9cf44d6cc2d61042a96a40cbea9a8d14ec9dd
MD5 d3797b85df1cd20a4b3568a1308b2e1c
BLAKE2b-256 d1a5feaf66ee0a4d28ef6a94cc8de11ef80a66dd7c73f0ba0230716f72e09874

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page