I retrieved Twitter data via the streaming API on Python, however, I am also interested in how the public metrics evolve during the time. As a result, I would like to request on a daily basis the metrics.
Unfortunately, the API for the status update can only handle 100 requests at a time. I have a list of all id's, how is it possible to automatically split the string of id's so that all of them will be requested, always in batches of 100?
Thank you a lot in advance!
Keep it as list of IDs instead of single string.
And then you can use
range(len(...))with[n:n+100]likeYou can even use
yieldto create special function for thisEventually you can get
[:100]and slice[100:]but this destroy list so you have to do it on copy of this listYou can also use some external modules for this.
If you will have list of strings then you can convert back to single string using
join()For list of integers you may need to convert integers to strings