Fail to run train_init - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

👋 Introducing the Rasa Playground

Fail to run train_init

You have selected 0 posts.

post by hajoura on May 31, 2019

hey this the code

from **future** import absolute_import
from **future** import division
from **future** import unicode_literals

from rasa_core.actions import Action
from rasa_core.events import SlotSet

class ActionWeather(Action):
    def name(self):
        return 'action_weather'
    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)

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)]

issue 1 : no client.getcurrent member
issue 2: unused variable country

post by Juste on Jun 3, 2019

Hi @hajoura. The weatherbot example you are using is a bit outdated now. I will make sure to run updated by the end of this week. Just to check beforehand - which Rasa version are you using?

post by hajoura on Jun 7, 2019

thank you
rasa-core-sdk==0.11.0
rasa_core==0.11.1
0. rasa-nlu==0.13.2

Related topics

Topic Replies Views Activity
Custome action with api
Rasa Open Source
8 773 Jul 2019
Querying rest api
Rasa Open Source
9 1.2k May 2020
Error when running action server and in weather bot
Rasa Open Source
20 2.8k Mar 2020
Issue of actions.py do not know get_weather in rasa x
Rasa Open Source
5 863 Jun 2019
Weatherstack.com api
Rasa Open Source
7 1.0k Jun 2020