开发者

Getting a URL with Python

开发者 https://www.devze.com 2023-04-11 08:32 出处:网络
I\'m trying to do something similar to placekitten.com, 开发者_JS百科wherein a user can input two strings after the base URL and have those strings alter the output. I\'m doing this in Python, and I c

I'm trying to do something similar to placekitten.com, 开发者_JS百科wherein a user can input two strings after the base URL and have those strings alter the output. I'm doing this in Python, and I cannot for the life of me figure out how to grab the URL. In PHP I can do it with query string and $_REQUEST. I can't find a similar method in Python that doesn't rely on CGI.

(I know I could do this with Django, but that's serious overkill for this project.)


This is just by looking at the docs but have you tried it?

cherrypy.request.path_info

The docs say:

The ‘relative path’ portion of the Request-URI. This is relative to the script_name (‘mount point’) of the application which is handling this request.

http://docs.cherrypy.org/stable/refman/_cprequest.html#cherrypy._cprequest.Request.path_info

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号