Python と Google App Engine を使用しています。コードにミドルウェア クラスを追加しましたが、正常に動作しています。しかし今、ミドルウェア クラスでどの URL が呼び出されているかを知る必要があります。そこからURLを取得する方法がわかりません。
これは私が持っているものです:
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)
どうやら self.request.urlはミドルウェア クラスでは機能しません。私が現在いるURL(またはルート)を取得する方法を知っている人はいますか??