Balena-sdk-python how connect to

balena = Balena()
credentials = {‘username’:"******", ‘password’:"******"}
print(balena.auth.login(**credentials))

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.MYHOST.xyz', port=443): Max retries exceeded with url: /login_ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

How to provide ssl?

Hi there,

At first glance, this looks like you’re trying to use the SDK against an openBalena instance where you’ve generated your own certificate. You should be able to use the REQUESTS_CA_BUNDLE envvar to point to a file containing trusted CAs (so in this case, pointing to a file with your self-signed CA in). This should then allow python to correctly verify the server certificate as valid.

Best regards,

Heds

Thanks. Missed this in docs. Could you please point me to this part in balena-sdk?

Hi @mexekanez,

This isn’t balena specific, but is a Python environment variable. Here’s a StackOverflow answer that discusses it (first hit I could find on Google): https://stackoverflow.com/questions/31448854/how-to-force-requests-use-the-certificates-on-my-ubuntu-system

This is similar in effect to NodeJS’s NODE_EXTRA_CA_CERTS environment variable, which also allows the passing in of self-signed CAs.

Best regards,

Heds

Understood. Thanks. no more questions