Json response gives total > 1 but no hits

19 views
Skip to first unread message

Ju Xuv

unread,
Aug 26, 2012, 8:09:24 AM8/26/12
to telepo...@googlegroups.com
Hello

Not a bug or anything but just wondering why I get a Json response like this (I use python):

{u'hits': [], u'total': 3, u'ok': True, u'took': 46}

Is there hidden results or else?

Thx

Ju Xuv

unread,
Aug 26, 2012, 11:18:10 AM8/26/12
to telepo...@googlegroups.com
Some more info might help... Actually, it might be a bug but can't find where it's located.

I have a python script that calls the API to check if there is new results for a specific search.

The script does a search based on a keyword + a period and ask for results based on recency.

If the search returns a list of hits, I take the unix date of the first element (the most recent) as the beginning of my next period search... just so I don't have to get elements before that one because I already have them.

So my script performs a search every minute or so to check for new elements...

The first time I run the script (whatever the period of search), it returns a list of hits... but when the scripts checks for new elements... that's when I get a Json response with a total > 0 but no hits to process. (see output in last message)

If I stop the script and rerun it with the last period searched (that turned a total > 1 but no hits), I do get a list of hits corresponding to the total number announced in the response...

This puzzles me. Something is wrong somewhere... but can't understand why.
Does the teleportd python package needs to be "closed" or something to do a new search?
Or is it pycurl that fails me?

Have attached my small script for you to check.

Thx
metahub.py

Stanislas Polu

unread,
Aug 27, 2012, 3:30:53 AM8/27/12
to telepo...@googlegroups.com
Hi Ju,

The API seems to work properly, the problem might come from the python driver.

To investigate that, do you have a specific request (with period) that demonstrates the unexpected behaviour consistently?

With that request, we can rebuild the URL used and test.

Thanks!

Best,

-stan

--
Stanislas Polu 
(New) Mo: +33 6 33 37 09 41 | Tw: @spolu | http://teleportd.com/api | Realtime Photo Search API

Ju Xuv

unread,
Sep 20, 2012, 12:05:27 PM9/20/12
to telepo...@googlegroups.com
Hello Stanislas.

Finally sorted out. A bug in my code.
I was not resetting the 'from' parameter in the query... so no doubt I had empty results.

Thx for your patience and understanding.

Ju

Stanislas Polu

unread,
Sep 20, 2012, 12:06:43 PM9/20/12
to telepo...@googlegroups.com
OK! 

Good to hear it's working! :)

Best,

-stan

--
Stanislas Polu 
(New) Mo: +33 6 33 37 09 41 | Tw: @spolu | http://teleportd.com/api | Realtime Photo Search API



Reply all
Reply to author
Forward
0 new messages