keiffster / program-y

Python 3.x based AIML 2.0 Chatbot interpreter, framework, related programs and knowledge files
https://keiffster.github.io/program-y/
Other
350 stars 135 forks source link

Failure to get news api #153

Closed hiroka closed 6 years ago

hiroka commented 6 years ago

help

cd program-y/bots/y-bot ./y-bot.sh

>>> abc news
Traceback (most recent call last):
  File "/Users/h/program-y/src/programy/parser/template/nodes/extension.py", line 54, in resolve
    return self.resolve_to_string(client_context)
  File "/Users/h/program-y/src/programy/parser/template/nodes/extension.py", line 47, in resolve_to_string
    resolved = instance.execute(client_context, data)
  File "/Users/h/program-y/src/programy/extensions/newsapi/newsapi.py", line 93, in execute
    return self.get_news(context, source, max_num, sort, reverse)
  File "/Users/h/program-y/src/programy/extensions/newsapi/newsapi.py", line 30, in get_news
    newsapi = self.get_news_api_api(context)
  File "/Users/h/program-y/src/programy/extensions/newsapi/newsapi.py", line 26, in get_news_api_api
    return  NewsAPI(context.bot.license_keys)
AttributeError: 'Bot' object has no attribute 'license_keys'
I try to be generous, caring and warm.

y-bot/config/license.keys

NEWSAPI_API_KEY=XXXXXXXXXXXXXXXXXXXXXX
keiffster commented 6 years ago

You need a license key, I have updated the documentation on the wiki on how to get a license key and add it to license.keys file

https://github.com/keiffster/program-y/wiki/Y-Bot-NewsAPI-Extensions

hiroka commented 6 years ago

Thank you! But I already had a license key. And now I was able to get the news using the previous version.

keiffster commented 6 years ago

Sorry, misunderstood, found and fixed the issue, pushed to master and pypi, version 2.0.2

hiroka commented 6 years ago

Great! The problem was solved. I appreciate it.