from ipapi.client import IPAPIClientclient = IPAPIClient()try: info = client.query_ip("1.1.1.1") print(info.model_dump_json(indent=2))finally: client.client.close()
Client behavior
Run lookup.py from the source checkout. The published ipcore 0.1.2 distribution contains package metadata but no importable ipapi module; this setup uses the pinned repository instead.
The client uses Pydantic’s deprecated parse_raw method. Close its HTTP client after use; the wrapper has no context manager.
Go
github.com/ipqwery/ipapi-go
Runtime checked
Requirements
Go 1.24.2 or later
Source revision
fc7efc4
Install
Terminal
go get github.com/ipqwery/ipapi-go@fc7efc494870418b9f1143f642aba8f5802ebf9f
Run the install command inside a Go module. QueryIP returns a nested IPInfo value and an error for unsuccessful HTTP responses.
The client has no per-call timeout. Its omitempty tags omit false and zero values if you serialize the result again; the parsed values are retained.
Rust
ipapi
Runtime checked
Requirements
Rust 2021 edition · Tokio
Package version
0.1.0
Install
Terminal
cargo add ipapi@=0.1.0cargo add tokio --features macros,rt-multi-thread,time
Look up one IP
cargo run
src/main.rs
use std::time::Duration;#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let info = tokio::time::timeout( Duration::from_secs(5), ipapi::query_ip("1.1.1.1"), ).await??; println!("{}", info.ip); if let Some(isp) = info.isp { println!("{:?}", isp.asn); } Ok(())}
Client behavior
Add these dependencies to a Cargo project. The example bounds the lookup with a five-second Tokio timeout.
Optional nested fields use Option. The client decodes the response without checking its HTTP status first; use the HTTP reference for error-response handling.
import ipapi.java.Ipapi;import ipapi.java.IPInfo;public class Lookup { public static void main(String[] args) throws Exception { IPInfo info = Ipapi.queryIp("1.1.1.1"); System.out.println(info.getIp()); if (info.getIsp() != null) { System.out.println(info.getIsp().getAsn()); } }}
Client behavior
Build from the pinned source with JDK 21. This example belongs in a consumer with the built library on its classpath; it has not been runtime-checked here.
The source uses static methods in ipapi.java, with no API key. The README’s io.ipapi namespace and API-key constructor do not match this revision. HTTP status is not checked before decoding.
The current client parses each libcurl response chunk as a complete JSON document. A response split across chunks may not decode correctly.
The risk mapping leaves is_datacenter and risk_score unset. The own-IP callback also uses a different result type from its caller. Use a standard HTTP request until these paths are repaired.
using IpApi;using Microsoft.Extensions.DependencyInjection;using System.Text.Json;var services = new ServiceCollection();services.AddIpApiClient();using var provider = services.BuildServiceProvider();var client = provider.GetRequiredService<IIApiClient>();using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(5));var info = await client.QueryIpAsync("1.1.1.1", timeout.Token);if (info is null) throw new InvalidOperationException("Empty IP response");Console.WriteLine(JsonSerializer.Serialize(info));
Client behavior
Run this in a .NET console project. The registered interface is IIApiClient, with two initial I characters; the README’s IIpApiClient name is different.
The response uses nested Isp, Location and Risk objects. Pass a cancellation token to bound the request. The legacy multi-IP method is not supported by the API.
Before you integrate
Single-IP requests
Use one address per lookup. Some clients still expose bulk methods; the API rejects bulk requests. Read the bulk policy
Own-IP responses
The root endpoint returns the connecting process’s public IP as text by default. For a full own-IP JSON response, use the HTTP examples
Verification scope
Runtime checked means the displayed package or source revision was executed for single-IP lookups. Source examples have been reviewed against the code, but have not been executed. A source revision can differ from a published package.