本文整理汇总了Python中xmlrpclib.ServerProxy.twice方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.twice方法的具体用法?Python ServerProxy.twice怎么用?Python ServerProxy.twice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpclib.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.twice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import twice [as 别名]
'''
Created on Mar 31, 2016
@author: walchen
'''
from xmlrpclib import ServerProxy
if __name__ == '__main__':
proxy = ServerProxy('http://10.68.127.125:4242')
print proxy.twice(2)
示例2: ServerProxy
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import twice [as 别名]
#!/usr/bin/env python
from xmlrpclib import ServerProxy
s = ServerProxy('http://127.0.0.1:9000')
print s.twice(2)
示例3: len
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import twice [as 别名]
from xmlrpclib import ServerProxy,Fault
import socket
import sys
port = 12345
if len(sys.argv)>=2:
port = int(sys.argv[1])
ip = 'localhost'
url = 'http://{0}:{1}'.format(ip,port)
s = ServerProxy(url,allow_none=True)
try:
print(s.twice(2)) # Call a fictive method.
data = s.hello()
print('data from hello')
print(data)
#print(s.xxx()) # not exist
except Fault:
# connected to the server and the method doesn't exist which is expected.
print('Connected to server but the method does not exist')
pass
except socket.error:
# Not connected ; socket error mean that the service is unreachable.
print('Can not connect to server')