In [1]:
import logging
logging.basicConfig(level=logging.DEBUG)

import pipecat.http
import pipecat.limit
import pipecat.record
import pipecat.utility
import pipecat.device.weather
import pipecat.xml

In [2]:
pipe = pipecat.http.get("https://aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=KAEG")
pipe = pipecat.xml.parse(pipe)
pipe = pipecat.device.weather.metars(pipe)
pipe = pipecat.utility.add_timestamp(pipe)
pipe = pipecat.limit.count(pipe, count=1)

for record in pipe:
    pipecat.record.dump(record)


DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): aviationweather.gov
DEBUG:requests.packages.urllib3.connectionpool:https://aviationweather.gov:443 "GET /adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=KAEG HTTP/1.1" 200 620
altimeter: 29.958662 in_Hg
dewpoint: -2.0 degC
elevation: 1779.0 meter
flight-category: VFR
latitude: 35.13 degree
longitude: -106.8 degree
observation-time: 2017-05-03T02:48:00+00:00
raw: KAEG 030248Z 32011KT 10SM BKN120 17/M02 A2996
station-id: KAEG
temperature: 17.0 degC
timestamp: 2017-05-03T04:36:20.376639+00:00
visibility: 10.0 mile
wind-direction: 320 degree
wind-speed: 11 knot

DEBUG:pipecat:add_timestamp iteration stopped after 1 records.

In [ ]: