sounds.auth =========== .. py:module:: sounds.auth Attributes ---------- .. autoapisummary:: sounds.auth.COOKIE_FILE Classes ------- .. autoapisummary:: sounds.auth.AuthService Functions --------- .. autoapisummary:: sounds.auth.login_required Module Contents --------------- .. py:data:: COOKIE_FILE .. py:function:: login_required(method) Decorator to catch expired sessions and reauthenticate before trying again. .. py:class:: AuthService(*args, **kwargs) Bases: :py:obj:`sounds.base.Base` Service to handle authentication with BBC Sounds. .. py:attribute:: user_info :value: None .. py:attribute:: debug_login :value: False .. py:method:: set_user_info() -> None :async: .. py:property:: is_logged_in :type: bool Check if we have a valid session. .. py:property:: listener_country :type: Optional[str] Return the listener's current country. .. py:property:: is_in_uk :type: bool Listener is in the UK. .. py:property:: is_uk_listener :type: bool Listener has a UK-based account and is in the UK. .. py:method:: authenticate(username: str, password: str) -> bool :async: Signs into BBC Sounds. :param username: The username or email address to sign in with :param password: The password to sign in with :return: True if successfully logged in, False otherwise :rtype: bool :raises LoginFailedError: If the login fails for any reason :raises UnauthorisedError: If the login is not authorised .. py:method:: save_cookies_to_disk() Saved the cookie jar to disk to persist a session. .. py:method:: renew_session() :async: Renew a session which has expired, but user is logged in. .. py:method:: logout() :async: