Update escape_path for Python 3 compatibility.

This commit is contained in:
Jason R. Coombs 2021-01-30 11:47:53 -05:00
parent 210eb5b529
commit 5fc9674d3a

View File

@ -2,10 +2,12 @@
from __future__ import print_function
import os, sys, urllib, textwrap
import os, sys, textwrap
import codecs
from os.path import join
from six.moves import urllib # import urllib.parse
try:
from typing import Optional
from .types_ import Parameters
@ -284,4 +286,4 @@ def escape_path(path):
"""
# this always returns bytes, specifically US-ASCII, valid URL characters
segments = path.split("/")
return "/".join([urllib.quote(unicode_to_url(s)) for s in segments])
return "/".join([urllib.parse.quote(unicode_to_url(s)) for s in segments])