Unfortunately the only option currently available (Jan 2020) to use a managed identity is to use the .NET libraries in System.Data.SqlClient or Microsoft.Data.SqlClient. The good news is they are cross platform so you can call them from Linux however to bridge the Python gap you will need to call the .NET libraries from Python.
First to get started on using the .NET Core runtime on Linux.
The key is to use the access token to create your connection string.
var conn = (System.Data.SqlClient.SqlConnection)Database.GetDbConnection();
conn.AccessToken = (new Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result;
See full tutorial here https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi
Alternatively you can use the System.Data.SqlClient object or the new cross platform Microsoft.Data.SqlClient to achieve something similar.
Write-Verbose "Create SQL connectionstring"
$conn = New-Object System.Data.SqlClient.SQLConnection
$DatabaseName = 'Master'
$conn.ConnectionString = "Data Source=$SQLServerName.database.windows.net;Initial Catalog=$DatabaseName;Connect Timeout=30"
$conn.AccessToken = $($SPNToken)
$conn
Write-Verbose "Connect to database and execute SQL script"
$conn.Open()
$query = 'select @@version'
$command = New-Object -TypeName System.Data.SqlClient.SqlCommand($query, $conn)
$Result = $command.ExecuteScalar()
$Result
$conn.Close()
The above example is using the cross platform .NET core libraries. To call them from Python one can try to use the pythonnet library.
https://github.com/pythonnet/pythonnet