Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. FROM python:3.6
  2.  
  3. RUN pip install tweepy
  4.  
  5. RUN pip install pymongo
  6. RUN pip install asyncio
  7.  
  8. ADD tweepy_twitter_stream_v0.6.py /
  9.  
  10.  
  11. CMD [ "python", "./tweepy_twitter_stream_v0.6.py" ]
  12.  
  13. # Send a request to Twitter's server and save the data on tweepy iterator using hashtag_name.
  14. for tweet in tweepy.Cursor(api.search,q=hashtag_name,count=100,wait_on_rate_limit=True ,wait_on_rate_limit_notify= True).items():
  15.  
  16. # Convert tweepy object into json format
  17. tweet_as_json = tweet._json
  18. # Insert tweet to mongoDB
  19. tweets.insert_one(tweet_as_json)
  20.  
  21. for tweet in tweepy.Cursor(api.search,q=hashtag_name,count=100,wait_on_rate_limit=True ,wait_on_rate_limit_notify= True).items():
  22. File "/usr/local/lib/python3.6/site-packages/tweepy/cursor.py", line 49, in __next__
  23. return self.next()
  24. File "/usr/local/lib/python3.6/site-packages/tweepy/cursor.py", line 197, in next
  25. self.current_page = self.page_iterator.next()
  26. File "/usr/local/lib/python3.6/site-packages/tweepy/cursor.py", line 108, in next
  27. data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)
  28. File "/usr/local/lib/python3.6/site-packages/tweepy/binder.py", line 250, in _call
  29. return method.execute()
  30. File "/usr/local/lib/python3.6/site-packages/tweepy/binder.py", line 234, in execute
  31. raise TweepError(error_msg, resp, api_code=api_error_code)
  32. tweepy.error.TweepError: Twitter error response: status code = 403
  33.  
  34. docker run f384c515d331
Add Comment
Please, Sign In to add comment