Skip to main content

Python client for iplocate.net — IP geolocation API

Project description

iplocate-client

Python client for iplocate.net — IP geolocation API.

Installation

pip install iplocate-client

Quick start

from iplocate_client import IPLocate

client = IPLocate()

# Your current IP
client.lookup()

# Specific IP
client.lookup("8.8.8.8")

# Only specific fields
client.lookup("8.8.8.8", fields=["country", "city", "asn"])

Bulk lookup

Free tier: 50 req/min. With API key (free, requires account on iplocate.net): 250 req/min.

client = IPLocate(api_key="your_api_key")
results = client.bulk(["8.8.8.8", "1.1.1.1"])

Max 20 IPs per request.

Async

from iplocate_client import AsyncIPLocate

client = AsyncIPLocate()
data = await client.lookup("8.8.8.8")
results = await client.bulk(["8.8.8.8", "1.1.1.1"])

Available fields

city continent country country_iso latitude longitude timezone postal asn asn_number

Response always includes ip and ip_ver.

Error handling

from iplocate_client import RateLimitError, InvalidIPError

try:
    client.lookup("bad_ip")
except InvalidIPError as e:
    print(e)
except RateLimitError:
    print("slow down")

License

MIT

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

iplocate_client-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

iplocate_client-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file iplocate_client-0.1.0.tar.gz.

File metadata

  • Download URL: iplocate_client-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for iplocate_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1debadef69f3d3059f8d898e5adb1935fe478c63dd785ef9c31e5f98dffe267a
MD5 4460a819f65493112f68ce85cb0a8d3f
BLAKE2b-256 8ccd5707ebf2cf04ed77c84e86f69cc56e4cc8526e655eccf373c0dd525519a0

See more details on using hashes here.

File details

Details for the file iplocate_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iplocate_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b74fb1d2c7ea9174d8d3c460c059ca3ee7adaff5d97b4e5fa461fb450238629
MD5 4146dd0e19ea5c3929957dae5d8984d6
BLAKE2b-256 1c34d7f941d9a29f1f44730be32fb81434eedb87db2a2bc02a4f3aa5d0b0ccb6

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