My application is on GAE and I'm trying to figure out how to prevent hotlinking of images dynamically served (e.g. /image?id=E23432E) in Python. Please advise.
+5
A:
In Google webapp framework, you can extract the referer from the Request class:
def get(self):
referer = self.request.headers.get("Referer")
# Will be None if no referer given in header.
Note that's referer
, not referrer
(see this dictionary entry).
DzinX
2009-05-24 08:02:20
Thanks, that seems to work.
2009-05-25 14:50:13