예제 #1
0
 def test_saves_token_to_filesystem(self):
     directory = tempfile.mkdtemp()
     store = FileTokenStore(directory)
     token = YahooToken('some-token', 'some-secret')
     store.set('foo', token)
     with open(store.get_filepath('foo')) as stored_file:
         self.assertTrue('some-token' in stored_file.read())
예제 #2
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()
예제 #3
0
파일: storage.py 프로젝트: allanice001/RJ45
    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()
예제 #4
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
예제 #5
0
파일: storage.py 프로젝트: allanice001/RJ45
    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