Skip to main content

watch-ip-sdk

Official Python SDK for the Watch-IP visitor geolocation API.

Watch-IP looks up the geolocation of whoever is currently loading your page — it's designed to be called directly from the visitor's own browser with a publishable, origin-locked API key. There is no server-to-server or arbitrary-IP lookup mode; see the docs for why.

Calling it from Python therefore means calling it from your own server rather than a visitor's browser. That's a legitimate way to use this SDK for testing or internal tooling, but the request won't carry the Origin header a browser fetch sends automatically — and origin-locking means the API will reject it with origin_not_allowed unless you set origin= to one of the key's allowed origins yourself.

Install

pip install watch-ip-sdk

Usage

from watch_ip import WatchIP

client = WatchIP("wip_pub_xxxxxxxx", origin="https://example.com")
geo = client.get_geo()

print(geo["country"], geo["city"], geo["timezone"])

Or, for a one-off call without holding onto a client instance:

from watch_ip import get_geo

geo = get_geo("wip_pub_xxxxxxxx", origin="https://example.com")

Error handling

Every failure — a rejected request (invalid key, disallowed origin, rate limit) or a network error — raises a WatchIPError with a status and a stable code:

from watch_ip import WatchIP, WatchIPError

client = WatchIP("wip_pub_xxxxxxxx", origin="https://example.com")

try:
    geo = client.get_geo()
except WatchIPError as err:
    print(err.code, err.status, err)
    # e.g. "origin_not_allowed" 403 "This origin is not authorized for this API key."

Optional fields and timeouts

geo = client.get_geo(include=["hostname"], timeout=5.0)

Requirements

Python 3.9+. No runtime dependencies (uses urllib from the standard library).

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

watch_ip_sdk-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

watch_ip_sdk-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: watch_ip_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for watch_ip_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 841e49aee9947d578a20f1c300c6b1f34258cb15855d2aef8331430a56874836
MD5 e39947dc78cd6f539dbea1288e0b64cd
BLAKE2b-256 51f29f91f06e5e841db55eac0ddc9bb8bda24ba817df7bba7f929a09421b4ec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for watch_ip_sdk-0.1.0.tar.gz:

Publisher: sdk-python-publish.yml on Digitload/watch-ip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: watch_ip_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for watch_ip_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 127f41ff42de3ed6f8624964c481fb58a1801b7320f0c72e37f0c6203040bebe
MD5 5c8ff3a062d5d70aaa444825513cb39a
BLAKE2b-256 b26a719c0bb7a6dd9fdddf5c67592fde2122411543c8615b69794b28759fa477

See more details on using hashes here.

Provenance

The following attestation bundles were made for watch_ip_sdk-0.1.0-py3-none-any.whl:

Publisher: sdk-python-publish.yml on Digitload/watch-ip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

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