def metro_data():
    metro_obj = db.get_metros()
    for m in metro_obj:
        try:
            m_data = b.getMetroData(m.msa, m.state_id, m.best_places_url)
        except:
            print "ERROR could not get data for {}".format(m.msa)
            continue

        for d in m_data:
            db.set_metros(
                            state_id = d['state_id'],
                            cities = d['cities'],
                            population = d['population'], 
                            unemployment = d['unemployment'],
                            avg_commute = d['avg_commute'],
                            median_age = d['median_age'],
                            household_size = d['household_size'],
                            median_home_price = d['median_home_price'],
                            msa = d['msa'],
                            zipcodes = d['zipcodes']

                        )
        print "imported {}".format(m.msa)
    return
Example #2
0
#!/usr/bin/env python

import bestplaces

states = bestplaces.getStates('ny')

cities = bestplaces.getCityData('las_vegas', 'nv')

temp = bestplaces.getStates()

metros = bestplaces.getMetroData('anderson', 'in')