Skip to main content

Developers Toolbox

Real URL

Follow HTTP redirects and report the URL that actually serves the page. The hop list is kept from the URL you started with through to the last response. Bodies are not downloaded. Only http and https are followed.

The PyPI name is lupaxa-real-url. The import path is lupaxa.real_url. The console script is real-url. lupaxa is a namespace package — there is no lupaxa/__init__.py.

Public names: resolve, trace, normalize_url, Hop, RealUrlError, InvalidURLError, ResolveError, RedirectLoopError, TooManyRedirectsError, DEFAULT_TIMEOUT (10.0), DEFAULT_MAX_REDIRECTS (20), __version__, get_version().

Install

pip install lupaxa-real-url

Requires Python 3.10+ and httpx.

Library

from lupaxa.real_url import Hop, resolve, trace

resolve("https://example.com")
resolve("https://example.com", full=True)
resolve("https://example.com", status=True)
resolve("example.com", timeout=5.0, max_redirects=10)
Flags Return
default final URL
full=True list[str]
status=True list[Hop]
full=True, status=True list[Hop]

trace always returns the hop list. Hop is (url, status).

A missing scheme is tried as https:// first, then http:// if HTTPS cannot be fetched or returns 404. An explicit scheme is used as given. Relative Location headers are joined onto the current hop.

Situation Result
Final non-redirect response That URL is the real URL
Redirect with a Location header Follow the next hop
Redirect without Location Stop; that hop is treated as final
Same URL seen twice RedirectLoopError
Hop limit reached TooManyRedirectsError (default 20 hops)
No scheme; HTTPS fails or returns 404 Retry the same host as http://
Timeout or connection failure ResolveError (after HTTP fallback)
from lupaxa.real_url import RedirectLoopError, ResolveError, TooManyRedirectsError, resolve

try:
    resolve("https://example.com")
except RedirectLoopError as exc:
    print("Loop:", [hop.url for hop in exc.hops])
except TooManyRedirectsError as exc:
    print(f"Stopped after {len(exc.hops)} hops")
except ResolveError as exc:
    print(f"Fetch failed: {exc}")

normalize_url adds https:// when the scheme is missing and rejects empty strings, missing hosts, and non-HTTP schemes. resolve and trace still try http:// afterwards when the scheme was omitted.

CLI

real-url https://example.com
real-url --full https://example.com
real-url --status https://example.com
real-url --full --status https://example.com
real-url --version

The URL is a positional argument. --full combined with --status uses the --status layout.

Flag Meaning
url Starting URL (required unless --version)
--full Print every hop URL
--status Print STATUS URL for each hop
--version Print real-url x.y.z and exit 0
--help Show argparse help
Result Stdout Exit
Default success Final URL 0
--full One URL per hop 0
--status STATUS URL 0
--version real-url x.y.z 0
Invalid URL or missing error on stderr 2
Loop, hop limit, network error on stderr 1
if landing="$(real-url https://example.com)"; then
    echo "Landed on $landing"
fi

Development

make init
make python-install-dev
make python-check
The Lupaxa Project Footer

Metadata

Release files for lupaxa-real-url 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lupaxa-real-url 0.1.4
File Size Uploaded
lupaxa_real_url-0.1.4.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-real-url 0.1.4
File Interpreter ABI Platform
lupaxa_real_url-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / lupaxa_real_url-0.1.4.tar.gz

Download URL lupaxa_real_url-0.1.4.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b749285f61ff394db2e2f3dd30926946798a9e7d1b5fefd05b9078abb3dd165c
BLAKE2b-256 checksum
How to use checksums
21a5481913b07808539874df4e252cef21973983536b2b9edcc86428f27e37db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / lupaxa_real_url-0.1.4-py3-none-any.whl

Download URL lupaxa_real_url-0.1.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71a8466d53bc50e8d4abb070b92eca5aac762a1c89e7528f2401c2ef7f3dfc26
BLAKE2b-256 checksum
How to use checksums
61283d26bcc6271ba40283e9c1bf9ec674490215e9130428b6964f66da3e9ff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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