Skip to content

Commit

Permalink
Merge pull request #82 from ParthS007/patch2
Browse files Browse the repository at this point in the history
Fixes#63 Removed Method to access susi API service
  • Loading branch information
sudheesh001 authored Jan 21, 2018
2 parents 606604c + 283d0a8 commit b82b591
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 37 deletions.
28 changes: 0 additions & 28 deletions loklak.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,34 +287,6 @@ def settings(self):
' only localhost clients are granted.')
return json.dumps(return_to_user)

def susi(self, query=None):
"""Retrieve Susi query response.
Args:
query (str): Query term.
Returns:
json: Susi response.
"""
susi_application = 'susi/chat.json'
url_to_give = self.baseUrlSusi + susi_application
self.query = query
if query:
params = {}
params['q'] = self.query
return_to_user = requests.get(url_to_give, params=params)
if return_to_user.status_code == 200:
return return_to_user.json()
else:
return_to_user = {}
return_to_user['error'] = ('Looks like there is a problem in susi replying.')
return json.dumps(return_to_user)
else:
return_to_user = {}
return_to_user['error'] = ('Please ask susi something.')
return json.dumps(return_to_user)

def search(self, query=None, since=None, until=None, from_user=None, count=None):
"""Handle the searching.
Expand Down
4 changes: 0 additions & 4 deletions sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
hello = l.hello()
pprint(hello)

# Loklak Susi API
susi = l.susi('Hi I am Sudheesh')
pprint(susi)

# Loklak Peers API

peers = l.peers()
Expand Down
5 changes: 0 additions & 5 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ def test_user(self):
self.assertTrue('name' in result['user'])
self.assertTrue('screen_name' in result['user'])

def test_susi(self):
"""Susi test."""
result = self.loklak.susi('Hi I am Sudheesh')
self.assertTrue(len(result['answers']) >= 1)

def test_search(self):
"""Test search result."""
result = self.loklak.search('doctor who', count=18)
Expand Down

0 comments on commit b82b591

Please sign in to comment.