12.07.2015 Views

Submitting Form Data

Submitting Form Data

Submitting Form Data

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Submitting</strong> with POSTimport sys, urllib2, urllibzipcode = sys.argvfl]url = 'http://www.wunderground.com/cgibin/findweather/getForecast'data = urllib.urlencode([('query', zipcode)])req = urllib2.Request(url)fd = urllib2.urlopen(req, data)while 1:data = fd.read(1024)if not len(data):breaksys.stdout.write(data)13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!