proxywhirl.geo¶
IP Geolocation utilities for proxy country lookup.
Uses MaxMind GeoLite2-Country database for fast, offline lookups. Falls back to ip-api.com batch API if database not available.
Functions¶
|
Geolocate IPs using best available method. |
|
Add country info to proxy dictionaries. |
|
Batch geolocate IPs using ip-api.com (fallback). |
|
Geolocate IPs using local GeoLite2 database. |
Module Contents¶
- async proxywhirl.geo.batch_geolocate(ips, batch_size=100, max_batches=50, db_path=None)[source]¶
Geolocate IPs using best available method.
Tries in order: 1. Local GeoLite2 database (fast, no rate limits) 2. ip-api.com batch API (fallback, rate limited)
- Parameters:
batch_size (int) – Number of IPs per API batch
max_batches (int) – Maximum API batches to process
db_path (pathlib.Path | None) – Optional explicit path to GeoLite2 database
- Returns:
Mapping of IP to geo info with country and countryCode keys.
- Return type:
- proxywhirl.geo.enrich_proxies_with_geo(proxies, geo_data)[source]¶
Add country info to proxy dictionaries.
- async proxywhirl.geo.geolocate_with_api(ips, batch_size=100, max_batches=50)[source]¶
Batch geolocate IPs using ip-api.com (fallback).