Guest User

Untitled

a guest
Oct 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. got exception:
  2. 'SearchResults' object has no attribute 'text'
  3.  
  4. # coding:UTF-8
  5. import tweepy
  6. import time
  7.  
  8. while True:
  9.  
  10.  
  11. CONSUMER_KEY = '***********'
  12. CONSUMER_SECRET = '******************************'
  13. auth = tweepy.OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET)
  14. ACCESS_TOKEN = '***********************'
  15. ACCESS_SECRET = '*******************************'
  16. auth.set_access_token(ACCESS_TOKEN,ACCESS_SECRET)
  17.  
  18. api = tweepy.API(auth)
  19.  
  20. search = api.search(q='#紙飛行機',lang='ja',count=10)
  21. try:
  22. api.update_status(search.text)
  23. except AttributeError as e:
  24. print("got exception:")
  25. print(e)
  26.  
  27. time.sleep(30)
  28.  
  29. search = api.search(q='#紙飛行機',lang='ja',count=10)
  30. for s in search:
  31. api.update_status(s.text)
Add Comment
Please, Sign In to add comment