def _get_bom_stations():
    'Return {CONF_STATION: (lat, lon)} for all stations, for auto-config.\n\n    This function does several MB of internet requests, so please use the\n    caching version to minimise latency and hit-count.\n    '
    latlon = {}
    with io.BytesIO() as file_obj:
        with ftplib.FTP('ftp.bom.gov.au') as ftp:
            ftp.login()
            ftp.cwd('anon2/home/ncc/metadata/sitelists')
            ftp.retrbinary('RETR stations.zip', file_obj.write)
        file_obj.seek(0)
        with zipfile.ZipFile(file_obj) as zipped:
            with zipped.open('stations.txt') as station_txt:
                for _ in range(4):
                    station_txt.readline()
                while True:
                    line = station_txt.readline().decode().strip()
                    if (len(line) < 120):
                        break
                    (wmo, lat, lon) = (line[a:b].strip() for (a, b) in [(128, 134), (70, 78), (79, 88)])
                    if (wmo != '..'):
                        latlon[wmo] = (float(lat), float(lon))
    zones = {}
    pattern = '<a href="/products/(?P<zone>ID[A-Z]\\d\\d\\d\\d\\d)/(?P=zone)\\.(?P<wmo>\\d\\d\\d\\d\\d).shtml">'
    for state in ('nsw', 'vic', 'qld', 'wa', 'tas', 'nt'):
        url = 'http://www.bom.gov.au/{0}/observations/{0}all.shtml'.format(state)
        for (zone_id, wmo_id) in re.findall(pattern, requests.get(url).text):
            zones[wmo_id] = zone_id
    return {'{}.{}'.format(zones[k], k): latlon[k] for k in (set(latlon) & set(zones))}
Return {CONF_STATION: (lat, lon)} for all stations, for auto-config.

This function does several MB of internet requests, so please use the
caching version to minimise latency and hit-count.
def _get_bom_stations():
    'Return {CONF_STATION: (lat, lon)} for all stations, for auto-config.\n\n    This function does several MB of internet requests, so please use the\n    caching version to minimise latency and hit-count.\n    '
    latlon = {}
    with io.BytesIO() as file_obj:
        with ftplib.FTP('ftp.bom.gov.au') as ftp:
            ftp.login()
            ftp.cwd('anon2/home/ncc/metadata/sitelists')
            ftp.retrbinary('RETR stations.zip', file_obj.write)
        file_obj.seek(0)
        with zipfile.ZipFile(file_obj) as zipped:
            with zipped.open('stations.txt') as station_txt:
                for _ in range(4):
                    station_txt.readline()
                while True:
                    line = station_txt.readline().decode().strip()
                    if (len(line) < 120):
                        break
                    (wmo, lat, lon) = (line[a:b].strip() for (a, b) in [(128, 134), (70, 78), (79, 88)])
                    if (wmo != '..'):
                        latlon[wmo] = (float(lat), float(lon))
    zones = {}
    pattern = '<a href="/products/(?P<zone>ID[A-Z]\\d\\d\\d\\d\\d)/(?P=zone)\\.(?P<wmo>\\d\\d\\d\\d\\d).shtml">'
    for state in ('nsw', 'vic', 'qld', 'wa', 'tas', 'nt'):
        url = 'http://www.bom.gov.au/{0}/observations/{0}all.shtml'.format(state)
        for (zone_id, wmo_id) in re.findall(pattern, requests.get(url).text):
            zones[wmo_id] = zone_id
    return {'{}.{}'.format(zones[k], k): latlon[k] for k in (set(latlon) & set(zones))}