Guest User

Untitled

a guest
May 27th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. TypeError: can't pickle module objects
  2.  
  3. import multiprocessing as mp
  4. import tweepy
  5.  
  6. class Auth:
  7. def __init__(self, *args, **kwargs):
  8. self.consumer_key = '**********'
  9. self.consumer_secret = '**********'
  10. self.access_token = '**********'
  11. self.access_token_secret = '**********'
  12.  
  13. self.auth = tweepy.OAuthHandler(self.consumer_key, self.consumer_secret)
  14. self.auth.set_access_token(self.access_token, self.access_token_secret)
  15. self.api = tweepy.API(self.auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
  16.  
  17. def get_lists(self):
  18. self.following = self.api.friends_ids()
  19. return self.following
  20.  
  21. def get_users(self, lst):
  22. for id in lst:
  23. user = self.api.get_user(id)
  24. print(user)
  25. break
  26.  
  27. def run_mp(self, lst):
  28. p = mp.Process(target=self.get_users, args=(lst,))
  29. p.start()
  30.  
  31. if __name__ == '__main__':
  32. a = Auth()
  33. user_list = a.get_lists()
  34. a.run_mp(user_list)
Add Comment
Please, Sign In to add comment