Get referring URL for Flask request

request.referrer contains the URL the request came from, although it might not be sent by the client for various reasons.

The attribute takes its value from the Referer (not a typo!) header:

referrer = request.headers.get("Referer")

or, using the Flask shortcut:

referrer = request.referrer

See this tutorial for an example.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)