Creating/updating/deleting records through XML-RPC
In the previous recipe, we saw how to search and read data through RPC. In this recipe, we will perform the remaining CRUD operations through RPC, which are Create, Update (write), and Delete (unlink).
Getting ready
We will create the Python program to create
, write
, and unlink
data on the library.book
model. Make sure you have installed the my_library
module and that the server is running on http://localhost:8069
.
How to do it...
Perform the following steps to create, write, and update a book's information through RPC:
- Add the
books_operation.py
file. You can place this file anywhere you want because the RPC program will work independently. - Add the following code to the
books_operation.py
file:from xmlrpc import client server_url = 'http://localhost:8069' db_name = 'book-db-14' username = 'admin' password = 'admin' common = client.ServerProxy(&apos...