updated deprecated cgi.parse_qsl to use six's parse_qsl

This commit is contained in:
VKen 2014-10-03 04:16:21 +08:00
parent ea3b372b4f
commit 33a7c1d438
1 changed files with 3 additions and 3 deletions

View File

@ -6,9 +6,9 @@ Some of the functions that used to be imported from this module have been moved
to the w3lib.url module. Always import those from there instead.
"""
import posixpath
from six.moves.urllib.parse import ParseResult, urlunparse, urldefrag, urlparse
from six.moves.urllib.parse import (ParseResult, urlunparse, urldefrag,
urlparse, parse_qsl)
import urllib
import cgi
# scrapy.utils.url was moved to w3lib.url and import * ensures this move doesn't break old code
from w3lib.url import *
@ -54,7 +54,7 @@ def canonicalize_url(url, keep_blank_values=True, keep_fragments=False,
"""
scheme, netloc, path, params, query, fragment = parse_url(url)
keyvals = cgi.parse_qsl(query, keep_blank_values)
keyvals = parse_qsl(query, keep_blank_values)
keyvals.sort()
query = urllib.urlencode(keyvals)
path = safe_url_string(_unquotepath(path)) or '/'