0

Using this it is possible to fetch user time line:

import pandas as pd
from stackapi import StackAPI
SITE = StackAPI('stackoverflow', key="please_add_your_key_here")
post = SITE.fetch('users/{ids}/timeline', ids=[5620], max_pages=10000000, page_size=100)

I can see that there are only 500 items, but I expect to have more than this.

How is it possible to fetch all items into one single api call?

Nathalie
  • 1,228
  • 7
  • 20
  • Not familiar with this specific API but other APIs I've worked with only allow a certain number of results per request. Often times they have an argument like `offset` so you could pull 500 at a time, then offset it by 500 and pull another 500, etc etc. I'd recommend reading the docs about this API to see how it works. Some APIs only allow you to pull the 500 most recent records – DBA108642 Dec 19 '19 at 14:28
  • https://stackapi.readthedocs.io/en/latest/user/quickstart.html#change-number-of-results – DeepSpace Dec 19 '19 at 14:28
  • @DeepSpace thank you. I used max and page size and I thought it can iterate through this. However how can I iterate all results as I don't know for every user the max pages? – Nathalie Dec 19 '19 at 14:37

1 Answers1

0

In one not because it will make extra load to the database & the service backend. You can use pagination to extract all the required data left in the cursor.

https://api.stackexchange.com/docs/paging

Alexandr Shurigin
  • 3,921
  • 1
  • 13
  • 25
  • I used max and page size and I thought it can iterate through this. However how can I iterate all results as I don't know for every user the max pages? – Nathalie Dec 19 '19 at 14:45
  • Have you read the doc I've posted? There are links to the default wrapper which contains the required fields https://api.stackexchange.com/docs/wrapper – Alexandr Shurigin Dec 19 '19 at 14:55
  • I used this option `post = SITE.fetch('users/{ids}/timeline', ids=[5620], has_more = 1, max_pages=10000000, page_size=100) ` – Nathalie Dec 19 '19 at 16:00