import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
mydict = {'key1': 'value1', 'key2': 'value2'}
encoded_dict = urllib.parse.urlencode(mydict)
request = urllib.request.Request(myurl, encoded_dict)
response = request.urlopen().read()
Transferring dictionary via post request