forked from brandon-rhodes/fopnp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmlrpc_client.py
More file actions
22 lines (19 loc) · 744 Bytes
/
Copy pathxmlrpc_client.py
File metadata and controls
22 lines (19 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Foundations of Python Network Programming, Third Edition
# https://github.com/brandon-rhodes/fopnp/blob/m/py3/chapter18/xmlrpc_client.py
# XML-RPC client
import xmlrpc.client
def main():
proxy = xmlrpc.client.ServerProxy('http://127.0.0.1:7001')
print(proxy.addtogether('x', 'ÿ', 'z'))
print(proxy.addtogether(20, 30, 4, 1))
print(proxy.quadratic(2, -4, 0))
print(proxy.quadratic(1, 2, 1))
print(proxy.remote_repr((1, 2.0, 'three')))
print(proxy.remote_repr([1, 2.0, 'three']))
print(proxy.remote_repr({'name': 'Arthur',
'data': {'age': 42, 'sex': 'M'}}))
print(proxy.quadratic(1, 0, 1))
if __name__ == '__main__':
main()