My question is similar to this:
but he is trying to set the device variable, while I’m trying to set the device service variable in python.
I tried using
from balena import Balena import os balena = Balena() auth_token = os.environ['BALENA_API_KEY'] app_id = os.environ['BALENA_APP_ID'] balena.auth.login_with_token(auth_token) balena.models.environment_variables.service_environment_variable.create(app_id, 'main', 'TEST', 'test value')
to do that in the device container, but I got an error complains it’s unauthrized. Could you please tell me what’s wrong? Do I need to give it the account credential in order to do that? The API doc didn’t give an example: Balena Python SDK - Balena Documentation.