import urllib.parse
url = 'http://example.com/unicod\xc3\xa8'
url = urllib.parse.urlsplit(url)
url = list(url)
url[2] = urllib.parse.quote(url[2])
url = urllib.parse.urlunsplit(url)
print(url)
How to fetch a non-ascii url with Python urlopen?