Consuming HTTP Services in Python Transcripts
Chapter: Accessing authenticated HTTP services
Lecture: Concept Authenticated SOAP services with suds

Login or purchase this course to watch this video and the rest of the course contents.
0:01 If you are working with a Soap service, that has important business data
0:04 and if you are working with Soap service
0:07 you are probably doing something internal in an enterprise,
0:09 chances are it's going to require a username and password,
0:12 so I am going to show you now how to work with suds
0:15 and add basic authentication to all of your Soap operations.
0:18 So we've seen that the way we get started with suds is we say suds.client
0:22 and we import suds.cleint and we create a client class from that
0:27 and we pass the wsdl and then we just start calling operations,
0:29 like all posts, update posts, and whatnot, well, if we want to add authentication,
0:33 we have to import suds.transport.http and then from there,
0:38 we are going to create an http authenticated transport layer,
0:41 and we are going to set the username and password on the layer,
0:44 then all we got to do when we create the client
0:47 in addition to passing the wsdl say transport= this new trends,
0:50 thing that we've created, and all the subsequent operations
0:53 will be using that username and password.
0:55 Remember you really kind of want to minimize the number of times
0:57 you create this client because it dynamically downloads and parses the wsdl,
1:01 so you don't want to do that every single time, right,
1:04 you are going to probably do this once at the beginning,
1:06 and reuse this client throughout your app, now,
1:09 be aware if this was an https transport layer
1:14 so if the service lived at an https end point,
1:17 you'd want to import suds.transport.https,
1:20 you want to create an https authenticated transport, things like that.
1:24 So be sure to make that adjustment based on the transport layer
1:27 of secure versus insecure http, but add this little transport layer
1:30 and everything works just like before.