Ejemplo n.º 1
0
def get_weather_from_local_api(local_api_weather_endpoint, lat, lon):
    params = {
        'lat': lat,
        'lon': lon,
    }

    json_results = get_api_data(local_api_weather_endpoint, params)

    return json_results
Ejemplo n.º 2
0
    def run_api(self):
        data = {}
        if self.run_indoor_status:
            # print("Hitting INDOOR API")
            self.run_indoor_status = False
            data["api"] = "indoor_status"
            data["return"] = get_api_data(self.config_data["local_indoor_status_endpoint"], {})
        elif self.run_weather:
            # print("Hitting WEATHER API")
            self.run_weather = False
            data["api"] = "weather"
            data["return"] = get_weather_from_local_api(self.config_data["local_weather_endpoint"], self.location_config["latitude"], self.location_config["longitude"])

        self.get_data.emit(data)
Ejemplo n.º 3
0
    def get_runner_data():
        people = open_config_file(PEOPLE_CONFIG_FILENAME)
        location = open_config_file(LOCATION_CONFIG_FILENAME)

        #parms
        names = ""
        feels = ""
        genders = ""
        colors = ""
        ids = ""

        #setup parms
        for person in people["people"]:
            if ids != "":
                ids += ','
            ids += str(person["id"])

            if names != "":
                names += ','
            names += person["name"]

            if feels != "":
                feels += ','
            feels += person["feel"]

            if genders != "":
                genders += ','
            genders += person["gender"]

            if colors != "":
                colors += ','
            colors += person["color"]

        params = {
            'type': "calculate",
            "lat": location["latitude"],
            "lon": location["longitude"],
            "ids": ids,
            "feels": feels,
            "genders": genders,
            "names": names,
            "colors": colors
        }

        results = get_api_data(CLOTHING_API_ENDPOINT, params)

        return results
Ejemplo n.º 4
0
 def get_all_items():
     params = {'type': "allclothes"}
     all_items = get_api_data(CLOTHING_API_ENDPOINT, params)
     return all_items
Ejemplo n.º 5
0
    def get_moon_phase():
        api_config = open_config_file(API_CONFIG_FILE_NAME)

        moon_data = get_api_data(api_config["local_moon_phase_endpoint"], {})

        return moon_data