import requests

from server import settings

GOOGLE_NEWS_MODEL_NAME = 'GoogleNews-vectors-negative300.bin'


def _server_url():
    return settings.get('services', 'word_embeddings_server_url')


def google_news_2d(words):
    response = requests.post("{}/embeddings/2d.json".format(_server_url()),
                             data={'words[]': words,
                                   'model': GOOGLE_NEWS_MODEL_NAME})
    return response.json()['results']

@@ -217,16 +217,29 @@
 words):%0A
+    try:%0A    
     resp
@@ -335,16 +335,20 @@
         
+   
+ 
 data=%7B'w
@@ -432,16 +432,20 @@
 _NAME%7D)%0A
+    
     retu
@@ -474,8 +474,48 @@
 sults'%5D%0A
+    except Exception:%0A        return %5B%5D%0A

handle case where you don't have a word2vec server available #581