Exemple #1
0
	def run(self, dispatcher, tracker, domain):
		from apixu.client import ApixuClient
		api_key = '...'
		client = ApixuClient(api_key)

		loc = tracker.get_slot('location')
		current = client.getcurrent(q=loc)

		link = current
Exemple #2
0
    def run(self, dispatcher, tracker, domain):
        from apixu.client import ApixuClient
        api_key = '...'  # your apixu key
        client = ApixuClient(api_key)

        loc = tracker.get_slot('location')
        current = client.getcurrent(q=loc)

        country = current['location']['country']
        city = current['location']['name']
        condition = current['current']['condition']['text']
        temperature_c = current['current']['temp_c']
        humidity = current['current']['humidity']
        wind_mph = current['current']['wind_mph']

        response = """It is currently {} in {} at the moment. The temperature is {} degrees, the humidity is {}% and the wind speed is {} mph.""".format(
            condition, city, temperature_c, humidity, wind_mph)

        dispatcher.utter_message(response)
        return [SlotSet('location', loc)]
Exemple #3
0
	def run(self, dispatcher, tracker, domain):
		from apixu.client import ApixuClient
		api_key = 'db9b457e7f47e3a4e7a0327a7020678d' #your apixu key
		client = ApixuClient(api_key)
		
		loc = tracker.get_slot('location')
		current = client.getcurrent(q=loc)
		
		country = current['location']['country']
		city = current['location']['name']
		condition = current['current']['condition']['text']
		temperature_c = current['current']['temp_c']
		humidity = current['current']['humidity']
		wind_mph = current['current']['wind_mph']

		response = """It is currently {} in {} at the moment. The temperature is {} degrees, the humidity is {}% and the wind speed is {} mph.""".format(condition, city, temperature_c, humidity, wind_mph)
						
		dispatcher.utter_message(response)
		return [SlotSet('location',loc)]


#http://api.weatherstack.com/current?access_key=db9b457e7f47e3a4e7a0327a7020678d&query="New York"