In Python 3.x, you need to import urllib.parse.quote:
>>> import urllib.parse
>>> urllib.parse.quote("châteu", safe="")
'ch%C3%A2teu'
According to Python 2.x urllib module documentation:
NOTE
The
urllibmodule has been split into parts and renamed in Python 3 to
urllib.request,urllib.parse, andurllib.error.