API Reference


exception sxm.AuthenticationError[source]

SXM Authentication failed, renew session

exception sxm.SegmentRetrievalException[source]

failed to get HLS segment, renew session


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


SXM username


SXM password

regionstr (“US” or “CA”)

Sets your SXM account region


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


Returns if session is valid and ready to use


Needs documentation


Needs documentation


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


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.


SXM client to use

sxm.run_http_server(sxm: sxm.client.SXMClient, port: int, ip='', 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.


Port number to bind SXM Proxy server on


IP address to bind SXM Proxy server on