Given a URL like the following, how can I parse the value of the query parameters? For example, in this case I want the value of def
.
/abc?def='ghi'
I am using Django in my environment; is there a method on the request
object that could help me?
I tried using self.request.get('def')
but it is not returning the value ghi
as I had hoped.
There is a nice library w3lib.url
I know this is a bit late but since I found myself on here today, I thought that this might be a useful answer for others.
With parse_qsl(), "Data are returned as a list of name, value pairs."
Try with something like this:
Hope this helps
The urlparse module provides everything you need:
urlparse.parse_qs()