I’m using python and the Google App Engine. I’ve added a Middleware class to my code, which is working fine. But now i need to know which URL is called in the Middleware class. I’m don’t know how to get the URL from there.
This is what i have:
class OtherClasses(BaseHandler):
def get(self):
# some code...
def post(self):
# some code...
class Middleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
#logging.debug("Setting namespace..." + namespace)
print(self.request.url) #<--- Doesn't work in here...?
app = webapp2.WSGIApplication([ROUTES], debug=True, config=webapp2_config)
app = Middleware(app)
Appearently the self.request.url doesn’t work in the middleware class. Anyone any idea how i can get the URL (or the route) that i’m currently in??
1 Answer