Skip to main content

ip2geo — Python SDK

PyPI version Python License

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/

Metadata

Release files for ip2geoapi 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ip2geoapi 1.0.0
File Size Uploaded Provenance
ip2geoapi-1.0.0.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ip2geoapi 1.0.0
File Interpreter ABI Platform
ip2geoapi-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / ip2geoapi-1.0.0.tar.gz

Download URL ip2geoapi-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f7fd34994c528eb9c97fb69c4db7c339eea7ec92402f76b4d5d444c5afe3efbe
BLAKE2b-256 checksum
How to use checksums
9a1b7be7b95a857b121dffc1b415dc96623fcb23bd464840e4cc4d0c9a87bbb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / ip2geoapi-1.0.0-py3-none-any.whl

Download URL ip2geoapi-1.0.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9747e7534e5002c98beb5f4a649242b04d33421e8d91ffc21b6e9b3ab068485
BLAKE2b-256 checksum
How to use checksums
2faecc6136d84d4d08941db3a437eb612b4b6c60a091bb23590935f79c3afdb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for ip2geoapi 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page