theharshest 0 Newbie Poster

I am trying to submit the form at http://www.harshtechtalk.com/contact-us-harsh-tech-talk using the following code but no success. Please help!

#!C:/Python27/python.exe

import urllib
import urllib2

def main():
        proxy_info={
                        'user' : 'abc@abc.com',
                        'pass' : 'xyz',
                        'host' : 'xxxxxxxx',
                        'port' : 80
                        }
        proxy_support = urllib2.ProxyHandler({"http" : "http://%(user)s:%(pass)s@%(host)s:%(port)d"
% proxy_info})
        opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
        urllib2.install_opener(opener)
        url = 'http://www.harshtechtalk.com/contact-us-harsh-tech-talk'
        values = {
                        'your-name':'test_name',
                        'your-email':'test@gmail.com',
                        'your-subject':'python_test',
                        'your-message':'test_message'
                        }
        data = urllib.urlencode(values)
        req = urllib2.Request(url,data)
        response = urllib2.urlopen(req)
        the_page = response.read()
        print "done"

if __name__ == '__main__':
        main()

PS - I don't want to use "mechanize" because it doesn't support javascript. Please let me know if there is any other module which I can use to handle dynamic web forms.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.