I use xmlrpc.server
to build a server and use pickle.dumps()
to pickling some data. Then I use xmlrpc.client
to build a client and use pickle.loads()
to unpickle this data.
## server
server = SimpleXMLRPCServer(('0.0.0.0', 5005), allow_none=True)
# in _dispatch method:
result = perform_stuff()
return pickle.dumps(result)
## client
proxy = ServerProxy(f'http://{host}:{port}', allow_none=True)
result = proxy.make_rpc()
return pickle.loads(result.data)
However, I counter the following problems:
I don't know the difference between the bytes-like object and 'Binary'
I try to use bytes(ret) to solve this problem, but it has another one
Given a Binary
instance bin
, you can get the data as a bytes
or bytearray
instance by bin.data
.
I can only guess from the code snippet you provided, but the following should work:
ret = pickle.loads(ret.data)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With