markovbot27.py 文件源码

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

项目:markovbot 作者: esdalmaijer 项目源码 文件源码
def twitter_login(self, cons_key, cons_secret, access_token, \
        access_token_secret):

        """Logs in to Twitter, using the provided access keys. You can get
        these for your own Twitter account at apps.twitter.com

        Arguments

        cons_key        -   String of your Consumer Key (API Key)

        cons_secret     -   String of your Consumer Secret (API Secret)

        access_token    -   String of your Access Token

        access_token_secret
                    -   String of your Access Token Secret
        """

        # Raise an Exception if the twitter library wasn't imported
        if not IMPTWITTER:
            self._error(u'twitter_login', u"The 'twitter' library could not be imported. Check whether it is installed correctly.")

        # Log in to a Twitter account
        self._oauth = twitter.OAuth(access_token, access_token_secret, \
            cons_key, cons_secret)
        self._t = twitter.Twitter(auth=self._oauth)
        self._ts = twitter.TwitterStream(auth=self._oauth)
        self._loggedin = True

        # Get the bot's own user credentials
        self._credentials = self._t.account.verify_credentials()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号