Connection¶
-
class
spotify.connection.Connection(session)[source]¶ Connection controller.
You’ll never need to create an instance of this class yourself. You’ll find it ready to use as the
connectionattribute on theSessioninstance.-
property
state¶ The session’s current
ConnectionState.The connection state involves two components, authentication and offline mode. The mapping is as follows
LOGGED_OUT: not authenticated, offlineOFFLINE: authenticated, offlineLOGGED_IN: authenticated, onlineDISCONNECTED: authenticated, offline, was previously online
Register listeners for the
spotify.SessionEvent.CONNECTION_STATE_UPDATEDevent to be notified when the connection state changes.
-
property
type¶ The session’s
ConnectionType.Defaults to
ConnectionType.UNKNOWN. Set to aConnectionTypevalue to tell libspotify what type of connection you’re using.This is used together with
allow_network,allow_network_if_roaming,allow_sync_over_wifi, andallow_sync_over_mobileto control offline syncing and network usage.
-
property
allow_network¶ Whether or not network access is allowed at all.
Defaults to
True. Setting this toFalseturns on offline mode.
-
property
allow_network_if_roaming¶ Whether or not network access is allowed if
typeis set toConnectionType.MOBILE_ROAMING.Defaults to
False.
-
property
allow_sync_over_wifi¶ Whether or not offline syncing is allowed when
typeis set toConnectionType.WIFI.Defaults to
True.
-
property
allow_sync_over_mobile¶ Whether or not offline syncing is allowed when
typeis set toConnectionType.MOBILE, orallow_network_if_roamingisTrueandtypeis set toConnectionType.MOBILE_ROAMING.Defaults to
True.
-
property