File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,10 @@ def to_utf8_optional_iterator(x):
178
178
179
179
def escape (s ):
180
180
"""Escape a URL including any /."""
181
- return urllib .quote (s .encode ('utf-8' ), safe = '~' )
181
+ try :
182
+ return urllib .quote (s .encode ('utf-8' ), safe = '~' )
183
+ except AttributeError :
184
+ return urllib .parse .quote (s .encode ('utf-8' ), safe = '~' )
182
185
183
186
def generate_timestamp ():
184
187
"""Get seconds since epoch (UTC)."""
@@ -635,15 +638,21 @@ def _split_header(header):
635
638
# Split key-value.
636
639
param_parts = param .split ('=' , 1 )
637
640
# Remove quotes and unescape the value.
638
- params [param_parts [0 ]] = urllib .unquote (param_parts [1 ].strip ('\" ' ))
641
+ try :
642
+ params [param_parts [0 ]] = urllib .unquote (param_parts [1 ].strip ('\" ' ))
643
+ except AttributeError :
644
+ params [param_parts [0 ]] = urllib .parse .unquote (param_parts [1 ].strip ('\" ' ))
639
645
return params
640
646
641
647
@staticmethod
642
648
def _split_url_string (param_str ):
643
649
"""Turn URL string into parameters."""
644
650
parameters = parse_qs (param_str .encode ('utf-8' ), keep_blank_values = True )
645
651
for k , v in parameters .items ():
646
- parameters [k ] = urllib .unquote (v [0 ])
652
+ try :
653
+ parameters [k ] = urllib .unquote (v [0 ])
654
+ except AttributeError :
655
+ parameters [k ] = urllib .parse .unquote (v [0 ])
647
656
return parameters
648
657
649
658
You can’t perform that action at this time.
0 commit comments