Changeset 74:1aba83981490 for src/mlx
- Timestamp:
- 04/11/12 15:51:57 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/web.py
r67 r74 458 458 def run(self): 459 459 """Perform the retrieval opf the METARs.""" 460 tm = time.gmtime() 461 url = "http://weather.noaa.gov/pub/data/observations/metar/cycles/%02dZ.TXT" % \ 462 (tm.tm_hour,) 460 url = "http://www.aviationweather.gov/adds/dataserver_current/httpparam?" 461 data = urllib.urlencode([ ("dataSource" , "metars"), 462 ("requestType", "retrieve"), 463 ("format", "csv"), 464 ("stationString", " ".join(self._airports)), 465 ("hoursBeforeNow", "24"), 466 ("mostRecentForEachStation", "constraint")]) 467 url += data 463 468 f = urllib2.urlopen(url) 464 469 try: … … 468 473 if len(line)>5 and line[4]==' ': 469 474 icao = line[0:4] 470 if icao in self._airports: 471 result.metars[icao] = line.strip() 475 if icao in self._airports: 476 result.metars[icao] = line.strip().split(",")[0] 472 477 finally: 473 478 f.close()
Note:
See TracChangeset
for help on using the changeset viewer.