How can I consume a web service in Python using authentication?

Viewed 13

I'm trying to integrate the website we use in my company in an APP I developed in python, but I'm having trouble creating a SOLP WSDL query, I have the following code in PHP,

// URL do WSDL                       
$wsdl = "https://xxxxxxxxxxxxxx.php?wsdl";
$location = "https://xxxxxxxxxxxxxxxxxxxxxxxxxx.php";

$context = array('http' =>array('header' => 'Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
));

$client = new SoapClient($wsdl, array(
    "trace" => 1, // enable trace   
    "exceptions" => 1, // enable exceptions   
    "stream_context" => stream_context_create($context),   
    "location" => $location   
));

$idprocess = 'CAD004';
$titulo = "Teste";
$matsolic = "XXXXX";

$return1 = $client->newWorkflow(array(
                                        "ProcessID" => $idprocess,
                                        "WorkflowTitle" => $titulo,
                                        "UserID" => $matsolic
                                        ));   

$idwork = $return1->RecordID;

How do I convert this PHP code into a Python code?

0 Answers
Related