예제 #1
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def getTrends(self, woid ):
     try:
         js=self.twApi.trends_place(woid)
     except tweepy.RateLimitError as e:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
     return js
예제 #2
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def unFollowByScreenName(self, screenName):
     try:
         status = self.twApi.destroy_friendship(screen_name=screenName)
     except tweepy.RateLimitError:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
     return status
예제 #3
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def followUserByUserId(self, userId):
     try:
         status = self.twApi.create_friendship(user_id=userId)
     except tweepy.RateLimitError:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
     return status
예제 #4
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def postTweet(self, tweetStr):
     try:
         status = self.twApi.update_status(status=tweetStr)
     except tweepy.RateLimitError:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
     return status
예제 #5
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def replyTweet(self, text, user, tweetId):
     try:
         m = "@%s " %(user)+text
         self.twApi.update_status(m, in_reply_to_status_id=tweetId)
     except tweepy.RateLimitError as e:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
     return m
예제 #6
0
파일: twitter.py 프로젝트: vjymits/autoPost
 def __init__(self, consumer_key, consumer_secret, access_token, access_token_secret):
     try:
         auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
         auth.set_access_token(access_token, access_token_secret)
         self.twApi= tweepy.API(auth, wait_on_rate_limit=True)
     except tweepy.RateLimitError as e:
         raise TwitterRateLimitExceed()
     except tweepy.TweepError as e:
         raise TwitterError(msg=e.message)
예제 #7
0
파일: twitter.py 프로젝트: vjymits/autoPost
    def search(self, query, maxTweets, sinceId=0):
        log.info("Gonna to do search, query: "+str(query))

        try:
            if sinceId==0:
                searched_tweets = [status for status in tweepy.Cursor(self.twApi.search, q=query,
                                                                      ).items(maxTweets)]
            else:
                searched_tweets = [status for status in tweepy.Cursor(self.twApi.search, q=query,
                                             since_id=sinceId).items(maxTweets)]

        except tweepy.RateLimitError as e:
            log.info("Rate limit error")
            raise TwitterRateLimitExceed()
        except tweepy.TweepError as e:
            log.info("Tweep error")
            raise TwitterError(msg=e.message)
        return searched_tweets