A tiny ip.app client to query your IP, ASN, location & timezone using the 100% free IP.app API. Fast & reliable IP lookup.
Project description
ipapp • v4.0.0
Tiny stdlib-only client for ip.app. No dependencies on third party packages. Query your public IP address, ASN data, request headers, user-agent string, and more — programmatically or from the command line.
🛠 Installation
# From PyPI (after you publish)
pip install ipapp
# Local development / editable install (with test extras)
python -m pip install -e .[dev]
Python ≥ 3.8, no external runtime dependencies.
Using a virtual environment (recommended)
If your system Python is externally managed (PEP 668) you’ll need an isolated environment instead of installing into the OS packages. The fastest path is a virtual env:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e '.[dev]'
(Upgrade pip inside the venv if you like: python -m pip install --upgrade pip.)
Alternatively you can keep things completely separate with pipx:
pipx install --editable . --pip-args='.[dev]'
🚀 Quick-start (Python)
Each endpoint gets its own snippet so you can copy/paste exactly what you need.
Public IP
import ipapp
print(ipapp.get_ip()) # → "203.0.113.42"
Public IP via HEAD (fastest)
import ipapp
print(ipapp.get_ip(head=True)) # "203.0.113.42" via X-Ipapp-Ip header
ASN (plain-text)
import ipapp
print(ipapp.get_asn()) # → "AS12345"
ASN (JSON)
import ipapp
info = ipapp.get_asn(json=True)
# {'asn': 12345, 'holder': 'Example ISP', 'country': 'DE', ...}
ASN with caller IP merged (JSON only)
import ipapp
info = ipapp.get_asn(json=True, include_ip=True)
# {'asn': 12345, 'holder': 'Example ISP', ..., 'ip': '203.0.113.42', 'ip_version': '4'}
Timezone (plain-text)
import ipapp
print(ipapp.get_tz()) # → "Europe/Berlin"
Timezone (JSON)
import ipapp
info = ipapp.get_tz(json=True)
# {'tz': 'Europe/Berlin', ...}
Timezone with caller IP merged (JSON only)
import ipapp
info = ipapp.get_tz(json=True, include_ip=True)
# {'tz': 'Europe/Berlin', 'ip': '203.0.113.42', 'ip_version': '4'}
Location (JSON)
import ipapp
info = ipapp.get_location() # JSON by default
# {'city': 'Berlin', 'country': 'DE', 'region': 'Berlin', ...}
Location with caller IP merged (JSON only)
import ipapp
info = ipapp.get_location(include_ip=True)
# {'city': 'Berlin', 'country': 'DE', ..., 'ip': '203.0.113.42', 'ip_version': '4'}
Location (plain-text)
import ipapp
print(ipapp.get_location(json=False)) # raw plain-text response
All helpers raise ipapp.IPAppError on network problems or invalid responses.
Strict mode
All functions support a strict=True parameter that raises IPAppError instead of returning None when the service responds with "Unknown":
import ipapp
try:
ip = ipapp.get_ip(strict=True)
except ipapp.IPAppError:
print("IP address is unknown")
🖥 Quick-start (CLI)
Every function is mirrored by a sub-command. No arguments prints the IP (nice for scripts):
ipapp # 198.51.100.7
Run each endpoint separately:
ipapp ip # same as default
ipapp ip --json # {"ip": "198.51.100.7"}
ipapp ip --head # header-only mode
ipapp asn # AS12345
ipapp asn --json # {"asn": 12345, ...}
ipapp asn --json --include-ip # {"asn": 12345, ..., "ip": "198.51.100.7"}
ipapp tz # Europe/Berlin
ipapp tz --json # {"tz": "Europe/Berlin", ...}
ipapp tz --json --include-ip # {"tz": "Europe/Berlin", "ip": "198.51.100.7"}
ipapp location # {"city": "Berlin", "country": "DE", ...}
ipapp location --include-ip # {"city": "Berlin", ..., "ip": "198.51.100.7"}
ipapp location --head # header-only mode
🧪 Running the test suite
Tests are network-free (they monkey-patch the internal fetcher) so they run instantly:
pytest -q
# 4 passed in 0.02s
📦 Building & checking the package
# Ensure build tools are present
python -m pip install build twine
# Build wheel + sdist into ./dist/
python -m build
# Verify metadata is valid (no upload)
twine check dist/*
When you're ready to release, upload with Twine (or wire this into CI):
twine upload dist/*
🤝 Contributing
- Fork, create a feature branch, add tests for any new behaviour.
- Keep code PEP 8 compliant (the codebase sticks to stdlib only).
- Open a PR – CI will run
pytestand basic metadata checks.
MIT licensed – have fun!
Note: Version starts at 4.0.0 to avoid conflicts with a previously removed package on PyPI using the same name.
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
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 ipapp-4.0.0.tar.gz.
File metadata
- Download URL: ipapp-4.0.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d7fa23cf696f18d77ac671434b7aefe2c5128b26b3e86fff6fdb9d0c5ba338e
|
|
| MD5 |
7a5cc0b7cede0b9b62cfaaf30957a8ca
|
|
| BLAKE2b-256 |
ea62f208d79e59765c4f4b52486eb25e382e51336e5a7aae17b77846876f1ae6
|
File details
Details for the file ipapp-4.0.0-py3-none-any.whl.
File metadata
- Download URL: ipapp-4.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
508a85030f0a497986863bbbe90cd56089ce0a1324ad9e097b21f49c92512166
|
|
| MD5 |
ead0ee254ba4fcfe6ca17d1a897a1243
|
|
| BLAKE2b-256 |
1b47d3865dae40cbc3441b0913bea392669bdd9ca062cdd37aa9cf6b48fb7b08
|