I'm seeing some problems with the statuses/friends_timeline method.
Best explained with this piece of code:

from urllib import urlencode, FancyURLopener
from random import randint, sample
from simplejson import loads

method = "http://twitter.com/statuses/friends_timeline.json?";

def test(urlopener, count=None, max_page=None, runs=5):
    stats = []

    if not count:
        count = randint(1, 200)
    if not max_page:
        max_page = 3200 / count
    pages = sample(range(1, max_page + 1), runs)

    for page in pages:
        querystring = urlencode({'count' : count, 'page' : page})
        statuses = loads(urlopener.open(method + querystring).read())
        stats.append((count, page, len(statuses)))

    print "%s %s %s" % ('COUNT', 'PAGE', 'STATUSES')
    for run in stats:
        print "%5d %4d %8d" % run


Here is the output for a run - test(FancyURLopener(), 200, 7):
COUNT PAGE STATUSES
  200    7        0
  200    2      197
  200    6        0
  200    5        0
  200    1      198


1. Notice the odd number of statuses returned for pages # 1, 2. This
seems to happen regularly and the returned # is always >= (count - 5)
&& <= count.
2. I never seem to get any statuses beyond page # 4. (I definitely
have more >800 status messaged in my friends timeline).


Thanks!

Reply via email to