xxxxxxxxxx
# apps.twitter.com
# Get keys and access tokens from application settings
import tweepy, json
# Fill the fields
access_token = "..."
access_token_secret = "..."
consumer_key = "..."
consumer_secret = "..."
# Create Streaming object and authenticate
stream = tweepy.Stream(consumer_key, consumer_secret, access_token, access_token_secret)
# This line filters Twitter Streams to capture data by keywords:
stream.filter(track=['apples', 'oranges'])
xxxxxxxxxx
$ pip install tweepy
-
import tweepy
auth = tweepy.OAuthHandler("YOU_CONSUMER_KEY", "YOUR_CONSUMER_SECRET")
auth.set_access_token("YOUR_ACCESS_TOKEN", "YOUR_ACCESS_SECRET")
api = tweepy.API(auth)
# Tweet something
tweet = api.update_status("My first tweet!")
# Like the tweet you just made
api.create_favorite(tweet.id)
xxxxxxxxxx
import tweepy
auth = tweepy.OAuth1UserHandler(
consumer_key, consumer_secret, access_token, access_token_secret
)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
for tweet in public_tweets:
print(tweet.text)
xxxxxxxxxx
import tweepy
auth = tweepy.OAuth1UserHandler(
consumer_key, consumer_secret, access_token, access_token_secret
)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
for tweet in public_tweets:
print(tweet.text)
xxxxxxxxxx
import tweepy
auth = tweepy.OAuth1UserHandler(
consumer_key, consumer_secret, access_token, access_token_secret
)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
for tweet in public_tweets:
print(tweet.text)