OpenBalena Python SDK
1 min readJan 8, 2020
- Install balena-sdk in your python environment:
pip install git+https://github.com/balena-io/balena-sdk-python.git
2. Generate api key and save it somewhere
balena api-key generate myapikey
3. If you could recall you have to set NODE_EXTRA_CA_CERTS, somewhere in your .bashrc or .profile, do similar things for REQUESTS_CA_BUNDLE for the same certificate. Failure to do so, will cause your API request rejected with error SSL error [certificate verify failed]
export NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/ca.crt
export REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/ca.crt
4. Test the following code:
import balena
import osos.environ['BALENA_API_KEY'] = 'yourgeneratedapikey'
balenaapi = balena.Balena()
balenaapi.settings.set(key='pine_endpoint', value='https://api.vaultsonchain.com/v5/')
balenaapi.settings.set(key='api_endpoint', value='https://api.vaultsonchain.com/')
balenadevices = balenaapi.models.device.get_all()
5. Most likely you will not get any errors. The api works.