mydata = [('one', '1'), ('two', '2')]
mydata = urllib.parse.urlencode(mydata)
path = 'http://localhost/new.php'
req = urllib.request.Request(path, mydata)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
page = urllib.request.urlopen(req).read()
print(page)
Sending data using POST in Python to PHP