Post Form Submit with Python

How to write a Python Program to Post Form Submit with Python ?


Solution:

#!/usr/bin/env python

import urllib
import urllib2

url = 'https://docs.google.com/spreadsheet/formResponse?formkey=dEVSUzFBMk5mbG9qTjkwZUI5VEhvMEE6MQ'

user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'

values = {
# req_username, req_email, req_message
# Guest name:, Guest e-mail:, Write message:
'entry.0.single' : 'Metalx1000',
'entry.1.single' : 'http://filmsbykris.com',
}
headers = { 'User-Agent' : user_agent }

data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()


print the_page


Learn More :