Using urlparse.parse_qs() - first element in dict is keyed on URL+key, instead of just key?

Victor Hooi victorhooi at gmail.com
Tue Oct 29 18:34:15 EDT 2013


Hi,

I'm attempting to use urlparse.parse_qs() to parse the following url:

    https://www.foo.com/cat/dog-13?utm_source=foo1043c&utm_medium=email&utm_campaign=ba^Cn=HC

However, when I attempt to parse it, I get:

{'https://www.foo.com/cat/dog-13?utm_source': ['foo1043c'],
 'utm_campaign': ['ba^Cn=HC'],
 'utm_medium': ['email']}

For some reason - the utm_source doesn't appear to have been extracted correctly, and it's keying the result on the url plus utm_source, rather than just 'utm_source'?

Cheers,
Victor



More information about the Python-list mailing list