Root-level secrets for kaggle api

API documentations

class KaggleApi(api_client: Any | None = None)
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
(method) def authenticate() → None
authenticate the user with the Kaggle API. This method will generate a configuration, first checking the environment for credential variables, and falling back to looking for the .kaggle/kaggle.json configuration file.

No way to pass the secrets in the API functions

File “/home/adminuser/venv/lib/python3.10/site-packages/kaggle/api/”, line 403, in authenticate
raise IOError(‘Could not find {}. Make sure it's located in’
OSError: Could not find kaggle.json. Make sure it’s located in /home/appuser/.kaggle. Or use the environment method.

Even though I have .kaggle/kaggle.json in my project root. Kaggle API library is looking for credentials in OS /home/appuser/.kaggle.

how to put the this API credential .kaggle/kaggle.json in ‘os’ /home/appuser/kaggle
Note: Secrets set in Dashboard while deploying are not working

REPO: FraudDetection/requirements.txt at main · ArunKhare/FraudDetection · GitHub
Streamlit=1.29 Python =3.10
my function in repo: Working fine locally

 def _authenticate_kaggle_api(self):
        Authenticate Kaggle API using Kaggle.json
        return (str): api instance
        conn_location = self.data_ingestion_config.kaggle_config_file
        connect = load_json(conn_location)
        # Kaggle
        os.environ["KAGGLE_CONFIG_DIR"] = str(conn_location)
        os.environ["KAGGLE_USERNAME"] = connect["username"]
        os.environ["KAGGLE_KEY"] = connect["key"]
        api = KaggleApi()
        return api