API Reference

Exceptions

exception sxm.AuthenticationError[source]

SXM Authentication failed, renew session

exception sxm.SegmentRetrievalException[source]

failed to get HLS segment, renew session

SXMClient

class sxm.SXMClient(username: str, password: str, region: sxm.models.RegionChoice = RegionChoice.US, quality: sxm.models.QualitySize = QualitySize.LARGE_256k, user_agent: Optional[str] = None, update_handler: Optional[Callable[[dict], None]] = None)[source]

Sync wrapper class around SXMClientAsync

usernamestr

SXM username

passwordstr

SXM password

regionstr (“US” or “CA”)

Sets your SXM account region

user_agentOptional[str]

User Agent string to use for making requests to SXM. If None is passed, it will attempt to generate one based on real browser usage data. Defaults to None.

update_handlerOptional[Callable[[dict], None]]

Callback to be called whenever a playlist updates and new Live Channel data is retrieved. Defaults to None.

async_client : SXMClientAsync is_logged_in : bool

Returns if account is logged into SXM’s servers

is_session_authenticatedbool

Returns if session is valid and ready to use

sxmak_tokenstr

Needs documentation

gup_idstr

Needs documentation

channelsList[XMChannel]

Retrieves and returns a full list of all XMChannel available to the logged in account

favorite_channelsList[XMChannel]

Retrieves and returns a full list of all XMChannel available to the logged in account that are marked as favorite

HTTP Server

sxm.make_http_handler(sxm: sxm.client.SXMClientAsync, precache: bool = True) Callable[[aiohttp.web_request.Request], Coroutine[Any, Any, aiohttp.web_response.Response]][source]

Creates and returns a configured aiohttp request handler ready to be used by a aiohttp.web.run_app() instance with your SXMClient.

Really useful if you want to create your own HTTP server as part of another application.

sxmSXMClient

SXM client to use

sxm.run_http_server(sxm: sxm.client.SXMClient, port: int, ip='0.0.0.0', logger: Optional[logging.Logger] = None, precache: bool = True) None[source]

Creates and runs an instance of http.server.HTTPServer to proxy SXM requests without authentication.

You still need a valid SXM account with streaming rights, via the SXMClient.

portint

Port number to bind SXM Proxy server on

ipstr

IP address to bind SXM Proxy server on