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 and if you are working with Soap service
0:08 you are probably doing something internal in an enterprise, chances are it's going to require a username and password,
0:13 so I am going to show you now how to work with suds and add basic authentication to all of your Soap operations.
0:19 So we've seen that the way we get started with suds is we say suds.client and we import suds.cleint and we create a client class from that
0:28 and we pass the wsdl and then we just start calling operations, like all posts, update posts, and whatnot, well, if we want to add authentication,
0:34 we have to import suds.transport.http and then from there, we are going to create an http authenticated transport layer,
0:42 and we are going to set the username and password on the layer, then all we got to do when we create the client
0:48 in addition to passing the wsdl say transport= this new trends, thing that we've created, and all the subsequent operations
0:54 will be using that username and password. Remember you really kind of want to minimize the number of times
0:58 you create this client because it dynamically downloads and parses the wsdl, so you don't want to do that every single time, right,
1:05 you are going to probably do this once at the beginning, and reuse this client throughout your app, now, be aware if this was an https transport layer
1:15 so if the service lived at an https end point, you'd want to import suds.transport.https,
1:21 you want to create an https authenticated transport, things like that. So be sure to make that adjustment based on the transport layer
1:28 of secure versus insecure http, but add this little transport layer and everything works just like before.


Talk Python's Mastodon Michael Kennedy's Mastodon