aylien_newsapi_python icon indicating copy to clipboard operation
aylien_newsapi_python copied to clipboard

ApiTypeError: Got an unexpected keyword argument 'entities_title_links_dbpedia' to method list_stories

Open PaulHolocene opened this issue 3 years ago • 1 comments

Hi, just trying the Python SDK. The code block for Targeted story search: categories & entities does not work:

Screenshot 2022-10-17 at 13 41 32

the parameters entities_title_type and entities_title_links_dbpedia are raising ApiTypeErrors. How can I use these params?

ApiTypeError: Got an unexpected keyword argument 'entities_title_links_dbpedia' to method list_stories

PaulHolocene avatar Oct 17 '22 11:10 PaulHolocene

Hi Paul,

Apologies for that.

We have a new entity model that works with Wikipedia links instead of DBpedia links.

Once the model based on DBpedia is deprecated, it will throw errors when searching by DBpedia links, so please use Wikipedia links when searching for entities.

We have amended our documentation to reflect the correct search method for entities.

Please see below the correct snippet: `import aylien_news_api from aylien_news_api.rest import ApiException

configuration = aylien_news_api.Configuration() configuration.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'YOUR_API_KEY' configuration.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'YOUR_API_KEY' configuration.host = "https://api.aylien.com/news"

api_instance = aylien_news_api.DefaultApi(aylien_news_api.ApiClient(configuration))

opts= { 'entities_links_wikipedia': ['https://en.wikipedia.org/wiki/Citizens_Financial_Group'], 'entities_types': ['Bank'], 'categories_taxonomy': 'iptc-subjectcode', 'categories_id': ['04006002'], 'language': ['en'], 'per_page': 20, 'sort_by': 'recency' }

try: ## Make a call to the Stories endpoint for stories that meet the criteria of the search operators api_response = api_instance.list_stories(**opts) for story in api_response.stories: ## Print the title, source, and date of each story print("{} || {} || {}".format(story.published_at, story.source.name, story.title)) except ApiException as e: print('Exception when calling DefaultApi->list_stories: %s\n' % e)`

More about that on: https://docs.aylien.com/newsapi/Build-your-first-searches/#targeted-story-search-categories-amp-entities

In the future, if you need help, you can reach us faster and easier through [email protected] or our chat at https://docs.aylien.com/

Thanks,

Angelo Perrone Technical Support Specialist at AYLIEN

AngeloPerroneAY avatar Nov 14 '22 09:11 AngeloPerroneAY