How do I use pagination_token in Tweepy's get_liking_users?

Viewed 11

I am trying to get more than 100 results on the get_liking_users feature of tweepy v2. I'm not sure how to add the pagination part of the code as not addressing it directly gives me only 100 results, even though there is talk about pagination on the get_liking_users page (https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-tweets-id-liking_users#tab1). Because there wasn't a Python example I could fit, I tried using the pagination example from here (https://docs.tweepy.org/en/stable/v2_pagination.html) but it does not work.

client = tweepy.Client(bearer_token=bt,
                       wait_on_rate_limit=True)

df = pd.read_csv(r"csv file path")

l=[]

for u in df['url'][:10]:

    female=0
    male=0
    andy=0
    unknown=0
    mostly_female=0
    mostly_male=0

    a=u.split('/')
    x=a[-1]

    users = client.get_liking_users(id=x)

    tweepy.Paginator(max_results=1000, limit=1000)
    
    tempnames = []

    columns = ['display_name',
               'username',
               'user_location']

    for user in users.data:
      tempnames.append([user.name, user.username, user.location])
0 Answers
Related