credentials.py 文件源码

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

项目:spotify-connect-scrobbler 作者: jeschkies 项目源码 文件源码
def save(self, config_file_path):
        """Save credentials to file.

        Args:
            config_file_path (path-like object): Path to file containing
            credentials. The file os opened and closed by this method.
        """
        with open(config_file_path, 'w') as f:
            data = {}
            if self.lastfm is not None:
                data['lastfm'] = {'session_key': self.lastfm.session_key}

            if self.spotify is not None:
                data['spotify'] = {
                    'access_token': self.spotify.access_token,
                    'token_type': self.spotify.token_type,
                    'refresh_token': self.spotify.refresh_token,
                    'scope': self.spotify.scope
                }

            json.dump(data, f)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号