Skip to content

Instantly share code, notes, and snippets.

@xingkaixin
Last active August 29, 2015 14:06
Show Gist options
  • Save xingkaixin/3d9193436b50a57a886e to your computer and use it in GitHub Desktop.
Save xingkaixin/3d9193436b50a57a886e to your computer and use it in GitHub Desktop.
RPC Simple Python
Server:
127.0.0.1 - - [14/Sep/2014 00:30:57] "POST /RPC2 HTTP/1.1" 200 -
Client:
result: -60
result type: <type 'int'>
from xmlrpclib import ServerProxy
server = ServerProxy("http://localhost:8000")
try:
ret = server.add(30,90)
print 'result:', ret
print 'result type:', type(ret)
except Exception as ex:
print "exception", ex
from xmlrpclib import ServerProxy
server = ServerProxy("http://localhost:8000")
try:
ret = server.minus(30,90)
print 'result:', ret
print 'result type:', type(ret)
except Exception as ex:
print "exception", ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment