From 85db4db01d2ef9375b27785792aa700f3adde558 Mon Sep 17 00:00:00 2001 From: militarpancho Date: Thu, 9 Mar 2017 16:20:16 +0100 Subject: [PATCH] added timeout message to finally fix #5 --- sentiment-meaningCloud/sentiment-meaningCloud.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sentiment-meaningCloud/sentiment-meaningCloud.py b/sentiment-meaningCloud/sentiment-meaningCloud.py index b70c1ce..1ba9cd2 100644 --- a/sentiment-meaningCloud/sentiment-meaningCloud.py +++ b/sentiment-meaningCloud/sentiment-meaningCloud.py @@ -24,8 +24,10 @@ class DaedalusPlugin(SentimentPlugin): 'txt': txt, 'src': 'its-not-a-real-python-sdk' } - r = requests.post(api, params=parameters, timeout=3) - + try: + r = requests.post(api, params=parameters, timeout=3) + except requests.exceptions.Timeout: + raise Error("Meaning Cloud API does not response") value = r.json().get('score_tag', None) if not value: raise Error(r.json())