Import the "urllib" module:
You can use the urllib.parse.urlencode() function to urlencode a querystring in Python.
urllib, urllib2, and urllib3 are all Python standard library modules for handling URLs.