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 new library called furl. I find this library to be most pythonic for doing url algebra. To install:
Code:
Btw, I was having issues using parse_qs() and getting empty value parameters and learned that you have to pass a second optional parameter 'keep_blank_values' to return a list of the parameters in a query string that contain no values. It defaults to false. Some crappy written APIs require parameters to be present even if they contain no values