twittstopher.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ewe_ebooks 作者: jaymcgrath 项目源码 文件源码
def __init__(self, twitter_username):
        # TODO: Login to twitter for corpus generation using end user's credentials
        auth = tweepy.OAuthHandler(CONSUMER_KEY,CONSUMER_SECRET)
        auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

        # Connect to Twitter - raise TweepError if we brick out on this
        try:
            api = tweepy.API(auth)
        except tweepy.TweepError:
            # TODO: make sure this error bubbles up and gets handled gracefully
            raise PermissionError("Twitter Auth failed")

        usr = api.get_user(twitter_username)
        self.username = twitter_username
        self.image = usr.profile_image_url
        # Exposes entire api - for debugging only
        # self.api = usr
        self.description = usr.description
        self.screen_name = usr.screen_name
        self.name = usr.name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号