Search code examples
pythonpyramid

Request current route including query strings?


I've been looking in the Pyramid API and haven't been able to find a method that allows me to extract the url in the user's address bar, specifically including the query strings. Is there a method I keep skimming across?

http://docs.pylonsproject.org/projects/pyramid/dev/api/request.html


Solution

  • It sounds like you just want request.url which is whatever the user typed in the address bar.

    request.GET is a dictionary of key/values in the query string.

    request.POST is a dictionary of key/values in the request body.

    request.params is a dictionary of the combination of both.

    This might be better explained in the webob documentation, which is effectively what Pyramid is using for its request and response objects.

    http://docs.webob.org/en/latest/index.html