from twitter import Twitter
t = Twitter(
auth=OAuth(
oauth_token, oauth_token_secret,
CONSUMER_KEY, CONSUMER_SECRET
)
)
pythonTweets = t.search.tweets(q = "#python")
print(pythonTweets)
ritorna NameError Traceback (ultima chiamata più recente) nel ()
1 from twitter import Twitter
----> 2 t = Twitter(auth=OAuth("xxxxx","xxxxx",
3 "xxxxx","xxxxx"))
4 pythonTweets = t.search.tweets(q = "#python")
5 print(pythonTweets)
NameError: nome "OAuth" non definito
risposte:
2 per risposta № 1La soluzione è anche importare OAuth dall'SDK di Twitter. Aggiorna la riga a questo:
from twitter import Twitter, OAuth