EventRegistry / event-registry-python

Python package for API access to news articles and events in the Event Registry
http://eventregistry.org/
MIT License
232 stars 54 forks source link

Can't get ArticlesUriList #35

Closed MiHess closed 7 years ago

MiHess commented 7 years ago

Hi, I am trying to get the ArticlesUriList as a result of my query, but keep getting the following error:

{'error': 'The user does not have sufficient permissions to query multiple return types in a single call.'}

What are the multiple return types? Is this just not possible in the free plan or am I doing it wrong?

er = EventRegistry(apiKey=API_KEY)

q = QueryArticles() q.addNewsSource(['www.nytimes.com']) q.addRequestedResult(RequestArticlesUriList()) print(er.execQuery(q))

Thanks a lot in advance. Mirco

gregorleban commented 7 years ago

Hi,

just replace q.addRequestedResult(RequestArticlesUriList()) with q.setRequestedResult(RequestArticlesUriList())

The reason for the error is that constructor of QueryArticles by default already sets article list as a return type. In your case, you want return data type to be article URI list, which is why you need to override the default choice. Multiple addRequesterResult() calls for the same query are allowed only for the paying customers.

MiHess commented 7 years ago

It works! Thanks a lot for the quick response!