def get(self):
    if not 'Authorization' in self.request.headers:
        self.response.headers['WWW-Authenticate'] = 'Basic realm="MYREALM"'
Python/WebApp Google App Engine - testing for user/pass in the headers