Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{u'error': u'No results match the criteria'} in Django app #17

Closed
narmold opened this issue Nov 16, 2016 · 2 comments
Closed

{u'error': u'No results match the criteria'} in Django app #17

narmold opened this issue Nov 16, 2016 · 2 comments

Comments

@narmold
Copy link

narmold commented Nov 16, 2016

So I'm trying to pull political news (nationally) and it was working fine. But now I get an output of

{u'error': u'No results match the criteria'}

when using my code in views.py of a Django app. If I run the same code in a standalone python program it gives me the above error.

Here's my code


	current = datetime.today()
	current.strftime("%Y-%m-%d")
	d = datetime.today() - timedelta(days=1)
	d.strftime("%Y-%m-%d")

	#Get Events
	er = EventRegistry()
	q = QueryEvents(lang = "eng")
	q.addConcept(er.getConceptUri("Politics", lang = "eng"))   
	q.addLocation(er.getLocationUri("United States"))
	#Sort events by their size of articles
	q.addRequestedResult(RequestEventsInfo(sortBy = "size", count=10))   # return event details for last 10 events
	q.setDateLimit(d, current)
	#q.EventInfoFlags()

	res = er.execQuery(q)

	#   Print all of the info the the execQuery
	pprint(res)

Could it be a limit on my requests? I've definitely done this a bunch of times, but I don't know why it would work in it's own python code.

I didn't know where else to post this question.

@gregorleban
Copy link
Collaborator

Try using
er.getLocationUri("United States")
instead of

er.getLocationUri("United States")

On Wed, Nov 16, 2016 at 2:12 AM, narmold notifications@github.com wrote:

So I'm trying to pull political news (nationally) and it was working fine.
But now I get an output of

{u'error': u'No results match the criteria'}

when using my code in views.py of a Django app. If I run the same code in
a standalone python program it gives me the above error.

Here's my code

` current = datetime.today()
current.strftime("%Y-%m-%d")
d = datetime.today() - timedelta(days=1)
d.strftime("%Y-%m-%d")

#Get Events
er = EventRegistry()
q = QueryEvents(lang = "eng")
q.addConcept(er.getConceptUri("Politics", lang = "eng"))
q.addLocation(er.getLocationUri("United States"))
#Sort events by their size of articles
q.addRequestedResult(RequestEventsInfo(sortBy = "size", count=10)) # return event details for last 10 events
q.setDateLimit(d, current)
#q.EventInfoFlags()

res = er.execQuery(q)

Print all of the info the the execQuery

pprint(res)`

I didn't know where else to post this question.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/gregorleban/EventRegistry/issues/17, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAxaupsqzizEmePBJgDHK5xJSak-Ezewks5q-liJgaJpZM4KzOpH
.


Gregor Leban
Artificial Intelligence Laboratory, Jozef Stefan Institute
Phone: +386-31-321-804

Skype: gregorleban

@narmold
Copy link
Author

narmold commented Nov 16, 2016

I don't really understand the difference in between the two lines of code you posted.

EDIT: Now it works fine with no changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants