salesforce-marketingcloud / FuelSDK-Python

FuelSDK for python
Other
126 stars 193 forks source link

Can't log in with username / password #78

Open filipealc opened 7 years ago

filipealc commented 7 years ago

So, the problem is that with C# I could solve this issue with the following code:


private SoapClient CreateETFrameworkBinding(string endpointAddress, string username, string password)
{
    // Create the binding
    BasicHttpBinding binding = new BasicHttpBinding();
    binding.Name = "SoapBinding";
    binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
    binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
    binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
    binding.OpenTimeout = new TimeSpan(0, 10, 0);
    binding.CloseTimeout = new TimeSpan(0, 10, 0);
    binding.SendTimeout = new TimeSpan(0, 10, 0);
    binding.MaxBufferSize = 2147483647;
    binding.MaxBufferPoolSize = 524288;
    binding.MaxReceivedMessageSize = 2147483647;

    // Set the transport security to UsernameOverTransport for Plaintext usernames
    var endpoint = new EndpointAddress(endpointAddress);

    // Create the SOAP Client (and pass in the endpoint and the binding)
    SoapClient etFramework = new SoapClient(binding, endpoint);

    // Set the username and password
    etFramework.ClientCredentials.UserName.UserName = username;
    etFramework.ClientCredentials.UserName.Password = password;

    return etFramework;
}

Now I'm trying to migrate to python the code, but so far I think that maybe I'm too dumb to really work with SOAP on python, so, here I'm trying to make this work with the Fuel Sdk. I look at the java repository and found that there's an option to use the username / password authentication rather than client ID / client Secret but in the python repository I just couln't figure it out how to connect with exacttarget.

Any lights?