Form Post Trouble Using urllib
Steve Allgood
chiriones at yahoo.com
Wed Oct 15 02:48:22 EDT 2003
I'm having trouble posting a form at the USPS web site. I've been
successful using urllib at other sites, but I'm missing why this won't
work:
# begin code
# get zip+4
import urllib
def zip4query():
url = "http://www.usps.com/zip4"
data = {
'Selection': '1',
'urbanization': '',
'firm': '',
'address': '',
'address1': '1600 pennsylvania',
'address2': '',
'city': 'washington',
'state': 'DC',
'zipcode': '',
}
urldata = urllib.urlencode(data)
results = urllib.urlopen(url, urldata).read()
print results
zip4query()
# end code
I just get the query form back as my results. I didn't have this
problem before. What am I doing wrong?
Thanks,
Steve
More information about the Python-list
mailing list