Ejemplo n.º 1
0
    def set(self, name, token):
        """Write a token to file"""

        if hasattr(token, 'key'):
            token = YahooToken.to_string(token)

        if token:
            filepath = self.get_filepath(name)
            f_handle = open(filepath, 'w')
            f_handle.write(token)
            f_handle.close()
Ejemplo n.º 2
0
    def get(self, name):
        """Get a token from the filesystem"""

        filepath = self.get_filepath(name)

        if os.path.exists(filepath):
            f_handle = open(filepath, 'r')
            token = f_handle.read()
            f_handle.close()

            token = YahooToken.from_string(token)
            return token