コード例 #1
0
def fetch_aviationweather_taf(icao):
    r = http.request('GET', (AVIATIONWEATHER_TAF_URL % icao))
    d = ElementTree.fromstring((r.data.decode('utf-8')))
    if not d.find('data').find("TAF").find("raw_text").text:
        return None
    taf = d.find('data').find("TAF").find("raw_text").text
    return taf
コード例 #2
0
def fetch_faa_atis(icao):
    r = http.request('GET', 'https://datis.clowd.io/api/' + icao)
    d = json.loads(r.data.decode('utf-8'))
    if 'error' in d:
        return None
    atis = {}
    for a in d:
        if a['type'] == 'arr':
            atis['arr'] = a['datis']
        elif a['type'] == 'dep':
            atis['dep'] = a['datis']
        else:
            atis['combined'] = a['datis']
    return atis
コード例 #3
0
def fetch_pilotedge_atis(icao):
    r = http.request('GET', 'https://www.pilotedge.net/atis/' + icao + '.json')
    if len(r.data) < 3:
        return None
    d = json.loads(r.data.decode('utf-8'))
    return {"combined": d['text'].replace('\n\n', ' ')}
コード例 #4
0
def fetch_vatsim(icao):
    r = http.request('GET', 'http://metar.vatsim.net/metar.php?id=' + icao)
    return r.data
コード例 #5
0
def fetch_pilotedge(icao):
    r = http.request('GET', 'https://www.pilotedge.net/atis/' + icao + '.json')
    if len(r.data) < 3:
        return None
    d = json.loads(r.data.decode('utf-8'))
    return d['metar']
コード例 #6
0
def fetch_ivao_whazzup_blob():
    r = http.request('GET',
                     'https://api.ivao.aero/getdata/whazzup/whazzup.txt')
    return r.data.decode("ISO-8859-1").splitlines()
コード例 #7
0
def fetch_ivao_taf_blob():
    r = http.request('GET', IVAO_TAF_URL)
    return r.data.decode("ISO-8859-1").splitlines()
コード例 #8
0
def fetch_ivao_metar_blob():
    r = http.request('GET', 'http://wx.ivao.aero/metar.php')
    return r.data.decode("utf-8").splitlines()
コード例 #9
0
def fetch_vatsim_blob():
    r = http.request('GET', 'http://cluster.data.vatsim.net/vatsim-data.json')
    return json.loads(r.data.decode('utf-8'))
コード例 #10
0
def fetch_ms_blob():
    r = http.request(
        'GET',
        'https://fsxweatherstorage.blob.core.windows.net/fsxweather/metars.bin'
    )
    return r.data.decode("utf-8").splitlines()