anisette ======== .. py:module:: anisette .. autoapi-nested-parse:: Anisette provider in a Python package. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/anisette/__main__/index /autoapi/anisette/anisette/index /autoapi/anisette/cli/index Classes ------- .. autoapisummary:: anisette.AnisetteDeviceConfig anisette.Anisette Package Contents ---------------- .. py:class:: AnisetteDeviceConfig .. py:attribute:: server_friendly_description :type: str .. py:attribute:: unique_device_id :type: str .. py:attribute:: adi_id :type: str .. py:attribute:: local_user_uuid :type: str .. py:method:: default() -> typing_extensions.Self :classmethod: .. py:class:: Anisette(ani_provider: anisette._ani_provider.AnisetteProvider) The main Anisette provider class. This is the main Anisette provider class, which provides the user-facing functionality of this package. Each instance of :class:`Anisette` represents a single Anisette session. This class should not be instantiated directly through its __init__ method. Instead, you should use :meth:`Anisette.init` or :meth:`Anisette.load` depending on your use case. .. py:method:: init(file: BinaryIO | str | pathlib.Path | None = None, default_device_config: anisette._device.AnisetteDeviceConfig | None = None) -> typing_extensions.Self :classmethod: Initialize a new Anisette session from an Apple Music APK or Anisette.py library file. The file type will be detected automatically. If :param:`file` is not provided, a library bundle will be downloaded automatically. This file is usually a few megabytes large. :param file: A file, path or URL to a library file or Apple Music APK. :type file: BinaryIO, str, Path, None :return: An instance of :class:`Anisette`. :rtype: :class:`Anisette` .. py:method:: load(*files: BinaryIO | str | pathlib.Path, default_device_config: anisette._device.AnisetteDeviceConfig | None = None) -> typing_extensions.Self :classmethod: Load a previously-initialized Anisette session. Required files can be obtained using the :meth:`Anisette.save_provisioning`, :meth:`Anisette.save_libs` and/or :meth:`Anisette.save_all` methods. :param files: File objects or paths that together form the provider's virtual file system. :type files: BinaryIO, str, Path :return: An instance of :class:`Anisette`. :rtype: :class:`Anisette` .. py:method:: save_provisioning(file: BinaryIO | str | pathlib.Path) -> None Save provisioning data of this Anisette session to a file. The size of this file is usually in the order of kilobytes. Saving provisioning data is required if you want to re-use this session at a later time. A session may be reconstructed from saved data using the :meth:`Anisette.load` method. The advantage of using this method over :meth:`Anisette.save_all` is that it results in less overall disk usage when saving many sessions, since library data can be saved separately and may be re-used across sessions. :param file: The file or path to save provisioning data to. :type file: BinaryIO, str, Path .. py:method:: save_libs(file: BinaryIO | str | pathlib.Path) -> None Save library data to a file. The size of this file is usually in the order of megabytes. Library data is session-agnostic and may be used in as many sessions as you wish. It can also be used to initialize a new session, without requiring the full Apple Music APK. The advantage of using this method over :meth:`Anisette.save_all` is that it results in less overall disk usage when saving many sessions, since library data can be saved separately and may be re-used across sessions. :param file: The file or path to save library data to. :type file: BinaryIO, str, Path .. py:method:: save_all(file: BinaryIO | str | pathlib.Path) -> None Save a complete copy of this Anisette session to a file. The size of this file is usually in the order of megabytes. Saving session data is required if you want to re-use this session at a later time. A session may be reconstructed from saved data using the :meth:`Anisette.load` method. The advantage of using this method over :meth:`Anisette.save_provisioning` and :meth:`Anisette.save_libs` is that it is easier to use, since all information to reconstruct the session is contained in a single file. :param file: The file or path to save session data to. :type file: BinaryIO, str, Path .. py:method:: provision() -> None Provision the virtual device, if it has not been provisioned yet. In most cases it is not necessary to manually use this method, since :meth:`Anisette.get_data` will call it implicitly. .. py:method:: get_data() -> dict[str, Any] Obtain Anisette headers for this session. :return: Anisette headers that may be used for authentication purposes.