lucjon/Py-StackExchange — Issue #10: search() does not know when to stop
Author: momander
Created: 2011-11-29 23:24:27+00:00
State: open

When I run a search that returns more than one page of results, the library gets stuck asking for empty pages. For example, let's search for questions tagged "float" created since Nov 15, 2011:

``` python
from stackexchange import *
import datetime
WebRequestManager.debug = True
API_KEY = ''
site = Site(stackexchange.StackOverflow, API_KEY)
from_date = datetime.datetime(2011,11,15)
timestamp = int(time.mktime(from_date.timetuple()))
questions = site.search(tagged='float', min=timestamp, sort='creation')
for q in questions:
print q.creation_date
```

The print-out from the code above shows that the basic URL for this search is hit, 60 results are returned, page 2 is hit, 21 more results are returned. Then page 3 is hit (no results), page 4 is hit (no results), page 5 is hit (no results), etc. Control never returns to the calling code, as far as I can tell.