[熱情]

파이썬으로 트위터 이용하기.. 본문

Programming/python

파이썬으로 트위터 이용하기..

rootkaien 2016. 7. 19. 15:15

트위터 관련 라이브러리 설치



pip install tweepy


import tweepy
import datetime

consumer_key = 'GWQ________________u1Ei4sHp'
consumer_secret = '82rdhqQ_____________________34IgOfmI0P'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)

access_token = '742986558___________________________iTm26XM'
access_token_secret = '8WQtBZ_________________________vh9zEmqYsto'

auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

#트윗 포스트하기

tweet = str(datetime.datetime.now()) + ' Brain Python Test'
api.update_status(status=tweet)

print("Successfully Posted")
print()

# 타임 라인 일기
public_tweets = api.home_timeline()
for tweet in public_tweets:
    print('tweet.text') 


Comments