def retweet()

in Bot1/instrumented_file/twitterRetweet.py [0:0]


def retweet(api, search, numberOfTweets):
    xray_recorder.begin_subsegment('retweet')
    for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
        try:
            tweet_id = tweet.id
            print(tweet_id)
            if tweet.lang == "en":
                tweet.retweet()
                print('Retweeted the tweet')
            else:
                print('no retweet')
        except tweepy.TweepError as e:
            print(e.reason)
        except StopIteration:
            break
    xray_recorder.end_subsegment()