How to search and treat the result with Tweepy
<p>I 'm was looking for a module to make research in tweeter (the research bar) and take the profile id/username of all the profile in link with the research.</p>

<p>I have seen the api tweepy, i think the answer i'm looking for is hide in thes 2 fonction :
search_users
_lookup_users</p>

<pre><code>#!/usr/bin/env   python                                                                       
     #-*-coding:utf-8-*-                                                                                                                                                                       

import tweepy, time, sys

CONSUMER_KEY = '#'

CONSUMER_SECRET = '#'
ACCESS_KEY = '#'

ACCESS_SECRET = '#'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)

auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

api = tweepy.API(auth)

liste2 = ["X", "Y", "Z"]

i = 0

while (liste2[i] != '\0'):

  file = api.search.users(liste2[i])

  print "passed"

  i = i + 1
</code></pre>

<p>I still got nothing for list all the profile match with the search.</p>

<p>the doc : <a href="https://github.com/tweepy/tweepy/blob/master/tweepy/api.py" rel="nofollow">https://github.com/tweepy/tweepy/blob/master/tweepy/api.py</a></p>

<p>Thanks :)</p>

<p>You linked to the source code, not to the doc. The doc can be found <a href="http://docs.tweepy.org/en/v3.5.0/api.html" rel="nofollow">here</a>; be careful though, as it is not very up-to-date.</p>

<p>You can just do:</p>

<pre><code>import tweepy

CONSUMER_KEY = "#"
CONSUMER_SECRET = "#"
ACCESS_KEY = "#"
ACCESS_SECRET = "#"

#Twitter credentials
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
#api = tweepy.API(auth_handler=auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
api = tweepy.API(auth)

liste2 = ["X", "Y", "Z"]

for element in liste2:
    results = api.search_users(q=element)
    #results now contains a lot of `user` objects, let's iterate through it to see the usernames
    for user in results:
        print(user.screen_name)
</code></pre>

python tweepy