Skip to main content

Official Python SDK for the Ip2Geo API

Project description

ip2geo — Python SDK

Official Python SDK for the Ip2Geo API — fast IP geolocation, network intelligence, and security risk detection.


🚀 Get an API Key (Free)

You need an API key to use Ip2Geo.

👉 Get your free API key here:
https://ip2geoapi.com/

Free plan includes

  • 100,000 requests / month
  • No credit card required
  • ✅ Full access to security intelligence data
  • ✅ Instant activation

🧠 Why Ip2Geo?

  • Most IP data providers:
    • Charge extra for security fields
    • Require credit cards upfront
    • Hide important data behind higher tiers
    • Ip2Geo provides security intelligence by default, even on the free plan.

✨ Features

  • 🌍 Accurate IP geolocation (country, city, timezone, ISP)
  • 🛡️ Security intelligence included:
    • VPN detection
    • Proxy detection
    • TOR detection
    • Hosting / ASN classification
    • Trust score & risk level
  • ⚡ Fast global API
  • 📦 Simple, lightweight Python SDK
  • 🔓 No hidden paid-only fields (others charge extra for security data)

📦 Installation

pip install ip2geoapi

Quick Start

from ip2geo import Ip2Geo

client = Ip2Geo("YOUR_API_KEY")

data = client.lookup("8.8.8.8")

print(data)

Lookup your IP

from ip2geo import Ip2Geo

client = Ip2Geo("YOUR_API_KEY")

data = client.lookup("check")

print(data)

API Response

{
  "success": true,
  "ip": "8.8.8.8",
  "version": "ipv4",
  "geo": {
    "city": "Chicago",
    "country": "United States",
    "countryCode": "US",
    "region": null,
    "regionCode": null,
    "latitude": 37.751,
    "longitude": -97.822,
    "postalCode": null,
    "geonameId": 6252001,
    "accuracyRadius": 1000,
    "metroCode": null,
    "continentName": "North America",
    "continentCode": "NA",
    "isEuMember": false
  },
  "countryInfo": {
    "name": "United States of America",
    "alpha2Code": "US",
    "alpha3Code": "USA",
    "flag": "https://api.ip2geoapi.com/assets/flags/us.svg",
    "callingCodes": [
      "1"
    ],
    "currencies": [
      {
        "code": "USD",
        "name": "United States dollar",
        "symbol": "$"
      }
    ],
    "languages": [
      {
        "iso639_1": "en",
        "iso639_2": "eng",
        "name": "English",
        "nativeName": "English"
      }
    ]
  },
  "timezoneInfo": {
    "timezone": "America/Chicago",
    "utcOffsetSeconds": -21600,
    "utcOffsetText": "-06:00",
    "utcOffsetHours": -6,
    "isDst": false,
    "abbreviation": "CST",
    "localTime": "2025-12-22T21:46:07-06:00"
  },
  "network": {
    "cidr": "8.8.8.8/32",
    "prefixLen": 32,
    "asn": 15169,
    "asFormatted": "AS15169",
    "asName": "GOOGLE",
    "isp": "Google",
    "organization": "Google",
    "connectionType": "Corporate",
    "mobile": {
      "mcc": null,
      "mnc": null
    }
  },
  "asDetails": {
    "asn": 15169,
    "abuser_score": "0.001 (Low)",
    "descr": "GOOGLE, US",
    "country": "us",
    "active": true,
    "org": "Google LLC",
    "domain": "google.com",
    "abuse": "network-abuse@google.com",
    "type": "hosting",
    "created": "2000-03-30",
    "updated": "2012-02-24",
    "rir": "ARIN"
  },
  "security": {
    "isHosting": true,
    "isProxy": false,
    "proxyType": null,
    "isVpn": false,
    "vpnProvider": null,
    "vpnProviderUrl": null,
    "isTor": false,
    "isAnonymous": true,
    "trustScore": 65,
    "riskLevel": "medium"
  }
}

📄 Response Formats

JSON (default)

client.lookup("8.8.8.8")

YAML

client.lookup("8.8.8.8", format="yml")

XML

client.lookup("8.8.8.8", format="xml")

JSONP Callbacks

client.lookup("8.8.8.8", format="jsonp", callback="cbFunction")

Parameter Reference

Parameter Type Required Accepted Values Description
ip str Yes* IPv4 / IPv6 IP address to lookup. If check, your own IP is detected automatically.
format str Optional json (default), xml, yml, jsonp Response format. Defaults to JSON.
callback str Optional Alphanumeric + _ (max 64 chars) JSONP callback function name. Only valid when format="jsonp".

📘 Documentation

Full API documentation and field reference: https://ip2geoapi.com/documentation/

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

ip2geoapi-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ip2geoapi-0.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file ip2geoapi-0.1.3.tar.gz.

File metadata

  • Download URL: ip2geoapi-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ip2geoapi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ee999bfbf7f7642bfc0022a22d0a27ad4a8f431a98424e784dc6f4e67b2007d9
MD5 5e54714a5cdfb91c84f71490bd4c42b0
BLAKE2b-256 a969ff3e3467ef72ec6ea6c92bb7e788601d1ff59d19f9ee6a6a3d6f11adb366

See more details on using hashes here.

File details

Details for the file ip2geoapi-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ip2geoapi-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ip2geoapi-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a65e6a2e0384baf8bfe814ee558abd08581bed12536319e1c697d613f6ce3270
MD5 12004c03c221e140df1b8b26ff709d45
BLAKE2b-256 2881337d863ed63d7619dc7afa1327c62d19dabb5dbb6bcf0e72dc0c31dfa0e0

See more details on using hashes here.

Supported by

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