Use urllib.parse.urlencode to generate encoded url