API Reference¶
API:
Exceptions¶
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
- username
str SXM username
- password
str SXM password
- region
str(“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 :
SXMClientAsyncis_logged_in :boolReturns if account is logged into SXM’s servers
- is_session_authenticated
bool Returns if session is valid and ready to use
- sxmak_token
str Needs documentation
- gup_id
str Needs documentation
- channelsList[
XMChannel] Retrieves and returns a full list of all
XMChannelavailable to the logged in account- favorite_channelsList[
XMChannel] Retrieves and returns a full list of all
XMChannelavailable to the logged in account that are marked as favorite
- username
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 yourSXMClient.Really useful if you want to create your own HTTP server as part of another application.
- sxm
SXMClient SXM client to use
- sxm
- 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.HTTPServerto proxy SXM requests without authentication.You still need a valid SXM account with streaming rights, via the
SXMClient.- port
int Port number to bind SXM Proxy server on
- ip
str IP address to bind SXM Proxy server on
- port