且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Python 中获取当前 URL

更新时间:2023-02-21 17:50:52

试试这个:

self.request.url

此外,如果您只需要查询字符串,这将起作用:

Also, if you just need the querystring, this will work:

self.request.query_string

最后,如果您知道要查找的查询字符串变量,您可以这样做:

And, lastly, if you know the querystring variable that you're looking for, you can do this:

self.request.get("name-of-querystring-variable")