I am trying to post to this page and get the result:
https://writerep.house.gov/writerep/welcome.shtml
I tried this:
import urllib
import urllib2
sURL = 'https://writerep.house.gov/writerep/welcome.shtml'
dInfo = { "state" : 'WAWashington', "zipcode" : '98103', "zipext" : '' }
sSendData = urllib.urlencode( dInfo )
resp = urllib2.urlopen( sURL, sSendData )
I get an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.5/urllib2.py", line 387, in open
response = meth(req, response)
File "/usr/lib/python2.5/urllib2.py", line 498, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.5/urllib2.py", line 425, in error
return self._call_chain(*args)
File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/usr/lib/python2.5/urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 405: Method Not Allowed
I am using Python 2.5.2 at the moment.
I would appreciate any tips to get this working.
Thanks,