def from_oauth_file(cls, filepath=None):
        """Get an object bound to the Twitter API using your own credentials.

        The `twitter` library ships with a `twitter` command that uses PIN
        OAuth. Generate your own OAuth credentials by running `twitter` from
        the shell, which will open a browser window to authenticate you. Once
        successfully run, even just one time, you will have a credential file
        at ~/.twitter_oauth.

        This factory function reuses your credential file to get a `Twitter`
        object. (Really, this code is just lifted from the `twitter.cmdline`
        module to minimize OAuth dancing.)
        """
        if filepath is None:
            # Use default OAuth filepath from `twitter` command-line program.
            home = os.environ.get('HOME', os.environ.get('USERPROFILE', ''))
            filepath = os.path.join(home, '.twitter_oauth')

        oauth_token, oauth_token_secret = read_token_file(filepath)

        twitter = cls(
            auth=OAuth(
                oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET),
            api_version='1.1',
            domain='api.twitter.com')

        return twitter
def from_oauth_file ( cls , filepath = None ) : if filepath is None : home = os . environ . get ( 'HOME' , os . environ . get ( 'USERPROFILE' , '' ) ) filepath = os . path . join ( home , '.twitter_oauth' ) oauth_token , oauth_token_secret = read_token_file ( filepath ) twitter = cls ( auth = OAuth ( oauth_token , oauth_token_secret , CONSUMER_KEY , CONSUMER_SECRET ) , api_version = '1.1' , domain = 'api.twitter.com' ) return twitter
Get an object bound to the Twitter API using your own credentials.

        The `twitter` library ships with a `twitter` command that uses PIN
        OAuth. Generate your own OAuth credentials by running `twitter` from
        the shell, which will open a browser window to authenticate you. Once
        successfully run, even just one time, you will have a credential file
        at ~/.twitter_oauth.

        This factory function reuses your credential file to get a `Twitter`
        object. (Really, this code is just lifted from the `twitter.cmdline`
        module to minimize OAuth dancing.)