From 877f0deec99efdccbc97747c67753c0742df0086 Mon Sep 17 00:00:00 2001 From: Matt Chandler Date: Mon, 8 Jun 2020 22:33:10 -0400 Subject: [PATCH] changed api to jserviceio and specified ntlk version for python2.7 --- helga_jeopardy.py | 14 +++++++------- setup.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/helga_jeopardy.py b/helga_jeopardy.py index 590c660..eadd706 100644 --- a/helga_jeopardy.py +++ b/helga_jeopardy.py @@ -25,7 +25,7 @@ URL_RE = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') -api_endpoint = 'http://www.trivialbuzz.com/api/v1/' +api_endpoint = 'http://jservice.io/api/' correct_responses = [ 'look at the big brains on {}', @@ -168,14 +168,14 @@ def retrieve_question(client, channel): logger.debug('initiating question retrieval') try: - tb_resp = requests.get('{}questions/random.json'.format(api_endpoint)) + tb_resp = requests.get('{}random.json'.format(api_endpoint)) except RequestException: - return "Could not retrieve a question from the TrivialBuzz API" + return "Could not retrieve a question from the jservice API" - json_resp = tb_resp.json()['question'] - question_text = json_resp['body'][1:-1] - answer = json_resp['response'] - category = json_resp['category']['name'] + json_resp = tb_resp.json()[0] + question_text = json_resp['question'] + answer = json_resp['answer'] + category = json_resp['category']['title'] value = json_resp['value'] if DEBUG: diff --git a/setup.py b/setup.py index 347a94d..1b1fb09 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ packages=find_packages(), install_requires = ( 'requests>=2.0.0', - 'nltk', + 'nltk==3.4.5', ), include_package_data=True, py_modules=['helga_jeopardy'],