Pythonでxmlrpc その3
昨日の続き。
ServerProxyに verbose=Trueを渡せば通信内容がわかるのでデバッグ用途に使える
# coding=utf-8 import xmlrpclib import datetime proxy = xmlrpclib.ServerProxy("http://localhost:8000/", verbose=True) today = proxy.today()
send: "POST / HTTP/1.1\r\nHost: localhost:8000\r\nAccept-Encoding: gzip\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 99\r\n\r\n<?xml version='1.0'?>\n<methodCall>\n<methodName>today</methodName>\n<params>\n</params>\n</methodCall>\n" reply: 'HTTP/1.0 200 OK\r\n' header: Server: BaseHTTP/0.3 Python/2.7.2 header: Date: Mon, 04 Mar 2013 12:39:02 GMT header: Content-type: text/xml header: Content-length: 163 body: "<?xml version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><dateTime.iso8601>20130304T21:39:02</dateTime.iso8601></value>\n</param>\n</params>\n</methodResponse>\n"