params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
f = urllib.request.urlopen('http://www.example.org/cgi-bin/query', params)
print(f.read())
How do I use Python's httplib to send a POST to a URL, with a dictionary of parameters?