python - Search users from specific country using Tweepy -


i'm trying twitter users given country using tweepy firs 20 users. every time p (page) increamented users list stays same... know there more 20 users usa must missing something!

here code snippet i'm using:

per_page = 20 num_page = 50      def getusersbyquery(self, query):         global per_page, num_page         p = 0         while p < num_page:             try:                 users_list = self.api.search_users(query, per_page=20, page=p)                 user in users_list:                     print(user.id)             except:                 print("pagination limits: page {} not exist".format(p))                 pass             p = p + 1         print("finished querying users!!")         return 

in main function:

t = tweeter() t.getusersbyquery(query='location=usa') 

any ideas?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -