How to implement hotlink prevention in Google App Engine

My application runs in GAE, and I'm trying to figure out how to prevent hot-linking of images dynamically served (e.g. / image? Id = E23432E) in Python. Please inform.

+5
source share
1 answer

In the Google webapp platform, you can extract the referent from the request class :

def get(self):
    referer = self.request.headers.get("Referer")
    # Will be None if no referer given in header.

Please note that referer, not referrer(see this entry in the dictionary ).

+11
source

All Articles