""" This module contains a simple function to connect to the AppleMusic API without having to load your credentials within your script or notebook. ???+ warning "Pre-requisites" To use this module, the following variables must be defined in your .env file: `appleSecretFile`, `appleKeyId`, `appleTeamId` See the [.env file configuration][configure-your-env-file] section if needed You only have to run : ``` from djagitit.api.apple import connect_apple() apl = connect_apple() ``` It uses the [applemusicpy](https://apple-music-python.readthedocs.io/en/latest/) package under the hood, so you can use all of this package features. You can use the `apl` object and access the appleMusic API from there. For instance to get data on the same masterpiece on AppleMusic: ``` apl.album(1508621774) ``` """ from dotenv import load_dotenv import os import applemusicpy load_dotenv() def connect_apple(): secret_file_path = os.getenv('appleSecretFile') keyId = os.getenv('appleKeyId') teamId = os.getenv('appleTeamId') with open(secret_file_path, 'r') as file: secret = file.read() am = applemusicpy.AppleMusic(secret, keyId, teamId) return am