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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
841e49aee9947d578a20f1c300c6b1f34258cb15855d2aef8331430a56874836
|
|
| MD5 |
e39947dc78cd6f539dbea1288e0b64cd
|
|
| BLAKE2b-256 |
51f29f91f06e5e841db55eac0ddc9bb8bda24ba817df7bba7f929a09421b4ec8
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
watch_ip_sdk-0.1.0.tar.gz -
Subject digest:
841e49aee9947d578a20f1c300c6b1f34258cb15855d2aef8331430a56874836 - Sigstore transparency entry: 2726043317
- Sigstore integration time:
-
Permalink:
Digitload/watch-ip@98c9cd8445b796a8423116148b3a09172555047d -
Branch / Tag:
refs/tags/sdk-python-v0.1.0 - Owner: https://github.com/Digitload
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-python-publish.yml@98c9cd8445b796a8423116148b3a09172555047d -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
127f41ff42de3ed6f8624964c481fb58a1801b7320f0c72e37f0c6203040bebe
|
|
| MD5 |
5c8ff3a062d5d70aaa444825513cb39a
|
|
| BLAKE2b-256 |
b26a719c0bb7a6dd9fdddf5c67592fde2122411543c8615b69794b28759fa477
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
watch_ip_sdk-0.1.0-py3-none-any.whl -
Subject digest:
127f41ff42de3ed6f8624964c481fb58a1801b7320f0c72e37f0c6203040bebe - Sigstore transparency entry: 2726043548
- Sigstore integration time:
-
Permalink:
Digitload/watch-ip@98c9cd8445b796a8423116148b3a09172555047d -
Branch / Tag:
refs/tags/sdk-python-v0.1.0 - Owner: https://github.com/Digitload
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-python-publish.yml@98c9cd8445b796a8423116148b3a09172555047d -
Trigger Event:
push
-
Statement type: