soco.music_services.token_store module

This module implements token stores for the music services

A user can provide their own token store depending on how that person wishes to save the tokens, or use the builtin token store (the default) which saves the tokens in a config file.

class soco.music_services.token_store.TokenStoreBase(token_collection='default')[source]

Token store base class

Instantiate instance variables

Parameters

token_collection (str) – The name of the token collection to use. This may be used to store different token collections for different client programs.

save_token_pair(music_service_id, household_id, token_pair)[source]

Save a token value pair (token, key) which is a 2 item sequence

load_token_pair(music_service_id, household_id)[source]

Load a token pair (token, key) which is a 2 item sequence

has_token(music_service_id, household_id)[source]

Return True if a token is stored for the music service and household ID

class soco.music_services.token_store.JsonFileTokenStore(filepath, token_collection='default')[source]

Implementation of a token store around a JSON file

Instantiate instance variables

Parameters

token_collection (str) – The name of the token collection to use. This may be used to store different token collections for different client programs.

classmethod from_config_file(token_collection='default')[source]

Load from file in config directory location

Parameters

token_collection (str) – The name of the token collection to use. This may be used to store different token collections for different client programs.

save_collection()[source]

Save the collection to a config file

save_token_pair(music_service_id, household_id, token_pair)[source]

Save a token value pair (token, key) which is a 2 item sequence

load_token_pair(music_service_id, household_id)[source]

Load a token pair (token, key) which is a 2 item sequence

has_token(music_service_id, household_id)[source]

Return True if a token is stored for the music service