Reputation: 31
I am new at tweepy, I was able to fetch data from twitter with following script :
import tweepy
from tweepy import OAuthHandler
access_token="---------"
access_token_secret="----------"
consumer_key="---------"
consumer_secret="-------"
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
print("public_tweets.text")
now want to fetch the username of the twitting person as well fetched tweets as
example:
"USERNAME": " --------------TWEET----------"
Thank You in advance
Upvotes: 2
Views: 2904
Reputation: 3148
public_tweets = api.home_timeline()
for tweet in public_tweets:
print('From :', tweet.user.screen_name, ', Text :', tweet.text)
Upvotes: 2