Does anyone know how to do this? Below is the equivalent using swis command but i'm trying to do it while calling the Orion Rest API using python.
"$swis = Connect-Swis -Trusted -Hostname"
You can't, unfortunately. The reason the PowerShell SDK is able to do that is because they're leveraging some .NET goodness under the hood. It's basic auth or nothing with the other languages.