How it works...

In the server script, the SecureXMLRPCServer subclass is created by inheriting from SimpleXMLRPCServer. In this subclass initialization code, we created the VerifyingRequestHandler class that actually intercepts the request and does the basic authentication using the authenticate() method.

In the authenticate() method, the HTTP request is passed as an argument. This method checks the presence of the value of authorization. If its value is set to basic, it then decodes the encoded password with the b64decode() function from the base64 standard module. After extracting the username and password, it then checks that with the server's given credentials set up initially.

In the run_server() function, a simple echo() sub function is defined and registered with the SecureXMLRPCServer instance.

In the client script, run_client() simply takes the server address and login credentials and passes them to the ServerProxy() instance. It then sends a single line message through the echo() method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.211.166