Spotify - 删除使用 None 值创建的访问令牌
Spotify - delete access token created with None value
我正在尝试删除使用 None 值生成的 Spotify 访问令牌,该令牌在我第二次尝试连接时中断。
我从这里得到这个片段 --> github thread,用于清除缓存的令牌:
import os
from json.decoder import JSONDecodeError
scope = <whatever_youwant>
try:
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
except (AttributeError, JSONDecodeError):
os.remove(f".cache-{username}")
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
但我在这里遇到语法错误:
os.remove(f".cache-{username}")
我的令牌缓存在哪里?我怎样才能删除它以重新获得访问权限?
缓存应存储在根目录(python 文件执行的位置)的文件中。
它被命名为.cache-{username}
。确保您已打开隐藏文件,否则您可能看不到它。
我正在尝试删除使用 None 值生成的 Spotify 访问令牌,该令牌在我第二次尝试连接时中断。
我从这里得到这个片段 --> github thread,用于清除缓存的令牌:
import os
from json.decoder import JSONDecodeError
scope = <whatever_youwant>
try:
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
except (AttributeError, JSONDecodeError):
os.remove(f".cache-{username}")
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
但我在这里遇到语法错误:
os.remove(f".cache-{username}")
我的令牌缓存在哪里?我怎样才能删除它以重新获得访问权限?
缓存应存储在根目录(python 文件执行的位置)的文件中。
它被命名为.cache-{username}
。确保您已打开隐藏文件,否则您可能看不到它。