Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running the code #104

Open
binuedwin opened this issue Sep 19, 2019 · 5 comments
Open

error when running the code #104

binuedwin opened this issue Sep 19, 2019 · 5 comments

Comments

@binuedwin
Copy link

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.

@shadhin-int
Copy link

I am facing the same issues

@gurtajs4
Copy link

gurtajs4 commented Jan 3, 2020

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

@aryabhat1
Copy link

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

@gurtajs4
Copy link

gurtajs4 commented Jan 7, 2020

@aryabhat1 what are the steps you following?
Anyways just try 'pip uninstall requests' first and then rerun your steps

@cesarcruzc
Copy link

cesarcruzc commented May 27, 2020

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: #109 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants