Weatherbot_Tutorial
Weatherbot_Tutorial copied to clipboard
error when running the code
HI,
When running the code i am getting the below error.. 2019-09-19 11:25:49 ERROR rasa.core.actions.action - Failed to run custom action 'action_weather'. Couldn't connect to the server at 'http://localhost:5055/webhook'. Is the server ru nning? Error: Cannot connect to host localhost:5055 ssl:None [Connect call failed ('127.0.0.1', 5055)] 2019-09-19 11:25:49 ERROR rasa.core.processor - Encountered an exception while running action 'action_weather'. Bot will continue, but the actions events are lost. Make sure to fix t he exception in your custom code.
I am facing the same issues
use below as actions.py
from future import absolute_import from future import division from future import unicode_literals
from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet import requests
class ActionWeather(Action): def name(self): return 'action_weather'
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')
params = {
'access_key': api_key,
'query': str(loc)
}
print("Searching in location ", loc)
api_result = requests.get('http://api.weatherstack.com/current', params)
current= api_result.json()
print ('res ', current)
country = current['location']['country']
city = current['location']['name']
condition = current['current']['weather_descriptions']
temperature_c = current['current']['temperature']
humidity = current['current']['humidity']
wind_mph = current['current']['wind_speed']
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)]
I get this error ERROR: rasa 1.0.9 has requirement requests~=2.22, but you'll have requests 2.21.0 which is incompatible when I install apixu from github. is there any request package version to which both rasa 1.0.9 and apixu are compatible. Pl help
@aryabhat1 what are the steps you following? Anyways just try 'pip uninstall requests' first and then rerun your steps
I get this error ERROR: rasa 1.0.9 has requirement requests~=2.22, but you'll have requests 2.21.0 which is incompatible when I install apixu from github. is there any request package version to which both rasa 1.0.9 and apixu are compatible. Pl help
@aryabhat1 Try this: https://github.com/JustinaPetr/Weatherbot_Tutorial/issues/109#issuecomment-634965431