# get pages in batches of 20
offset = 0
increment = 20
while True:
posts = client.call(posts.GetPosts({'number': increment, 'offset': offset}))
if len(posts) == 0:
break # no more posts returned
for post in posts:
do_something(post)
offset = offset + increment