def get_station_data(location):

    try:
        # initialize database
        mongo = MongoDriver(db_host, db_port, db_user, db_pass)

        entries = mongo.getAll(location)

        entry_list = []

        for x in entries:
            entry = Weather()
            entry.set_temp(x['temp'])
            entry.set_temp_max(x['temp_max'])
            entry.set_temp_min(x['temp_min'])
            entry.set_feels_like(x['feels_like'])
            entry.set_pressure(x['pressure'])
            entry.set_humidity(x['humidity'])
            entry.set_wind_speed(x['wind_speed'])
            if x['wind_deg'] != None:
                entry.set_wind_deg(float(x['wind_deg']))
            entry.set_clouds_all(x['clouds_all'])
            if x['rain1h'] != None:
                entry.set_rain1h(x['rain1h'])
            if x['rain3h'] != None:
                entry.set_rain3h(x['rain3h'])
            if x['snow1h'] != None:
                entry.set_snow1h(x['snow1h'])
            if x['snow3h'] != None:
                entry.set_snow3h(x['snow3h'])
            if x['visibility'] != None:
                entry.set_visibility(x['visibility'])
            entry.set_sunrise(x['sunrise'])
            entry.set_sunset(x['sunset'])
            entry.set_main(x['main'])
            entry.set_description(x['description'])
            entry.set_tstamp(x['tstamp'])

            entry_list.append(entry)
        # end of foor loop

        return entry_list
    except Exception as err:
        print(f'{err}')
        return []
    def getLastEntry(self, collection_name):
        database = self.__client["weathercrawler"]
        collection = database[str(collection_name)]
        lastEntry = collection.find_one(sort=[('$natural',-1)])

        #return lastEntry
        #lastEntry = collection.find().sort([('$natural',-1)]).limit(1)
        weatherObj = Weather()
        weatherObj.set_tstamp(lastEntry['tstamp'])
        weatherObj.set_temp(lastEntry['temp'])
        weatherObj.set_temp_max(lastEntry['temp_max'])
        weatherObj.set_temp_min(lastEntry['temp_min'])
        weatherObj.set_feels_like(lastEntry['feels_like'])
        weatherObj.set_description(lastEntry['description'])
        weatherObj.set_pressure(lastEntry['pressure'])
        weatherObj.set_humidity(lastEntry['humidity'])
        weatherObj.set_wind_speed(lastEntry['wind_speed'])
        weatherObj.set_wind_speed(lastEntry['wind_deg'])
        
        if lastEntry['wind_deg'] != None:
            weatherObj.set_wind_deg(float(lastEntry['wind_deg']))
        weatherObj.set_clouds_all(lastEntry['clouds_all'])
        if lastEntry['rain1h'] != None:
            weatherObj.set_rain1h(lastEntry['rain1h'])
        if lastEntry['rain3h'] != None:
            weatherObj.set_rain3h(lastEntry['rain3h'])
        if lastEntry['snow1h'] != None:
            weatherObj.set_snow1h(lastEntry['snow1h'])
        if lastEntry['snow3h'] != None:
            weatherObj.set_snow3h(lastEntry['snow3h'])
        if lastEntry['visibility'] != None:
            weatherObj.set_visibility(lastEntry['visibility'])
        weatherObj.set_sunrise(lastEntry['sunrise'])
        weatherObj.set_sunset(lastEntry['sunset'])
        weatherObj.set_main(lastEntry['main'])
        weatherObj.set_description(lastEntry['description'])
        weatherObj.set_tstamp(lastEntry['tstamp'])
        
        return weatherObj
db_pass = '******'

try:

    # initialize database
    mongo = MongoDriver(db_host, db_port, db_user, db_pass)

    entries = mongo.getAll('Vellberg')

    entry_list = []

    for x in entries:
        entry = Weather()
        entry.set_temp(x['temp'])
        entry.set_temp_max(x['temp_max'])
        entry.set_temp_min(x['temp_min'])
        entry.set_feels_like(x['feels_like'])
        entry.set_pressure(x['pressure'])
        entry.set_humidity(x['humidity'])
        entry.set_wind_speed(x['wind_speed'])
        if x['wind_deg'] != None:
            entry.set_wind_deg(float(x['wind_deg']))
        entry.set_clouds_all(x['clouds_all'])
        if x['rain1h'] != None:
            entry.set_rain1h(x['rain1h'])
        if x['rain3h'] != None:
            entry.set_rain3h(x['rain3h'])
        if x['snow1h'] != None:
            entry.set_snow1h(x['snow1h'])
        if x['snow3h'] != None:
            entry.set_snow3h(x['snow3h'])