本文整理汇总了Python中xmlrpc.client.ServerProxy.exists方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.exists方法的具体用法?Python ServerProxy.exists怎么用?Python ServerProxy.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpc.client.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import exists [as 别名]
__author__ = 'PyBeaner'
from xmlrpc.client import ServerProxy
s = ServerProxy("http://localhost:20000",allow_none=True)
s.set("foo","bar")
print(s.get("foo"))
print(s.keys())
print(s.exists("foo"))
if s.exists("foo"):
s.delete("foo")
示例2: VerifyCertSafeTransport
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import exists [as 别名]
class VerifyCertSafeTransport(SafeTransport):
def __init__(self, cafile, certfile=None, keyfile=None):
super().__init__()
self._ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
self._ssl_context.load_verify_locations(cafile)
if certfile:
self._ssl_context.load_cert_chain(certfile, keyfile)
self._ssl_context.verify_mode = ssl.CERT_REQUIRED
def make_connection(self, host):
s = super().make_connection((host, {'context': self._ssl_context}))
return s
# Create the client proxy
s = ServerProxy('https://localhost:15000',
transport=VerifyCertSafeTransport('server_cert.pem',
'client_cert.pem',
'client_key.pem'),
allow_none=True)
s.set('foo', 'bar')
s.set('spam', [1, 2, 3])
print(s.keys())
print(s.get('foo'))
print(s.get('spam'))
s.delete('spam')
print(s.exists('spam'))
示例3: ServerProxy
# 需要导入模块: from xmlrpc.client import ServerProxy [as 别名]
# 或者: from xmlrpc.client.ServerProxy import exists [as 别名]
kvserv.serve_forever()
# Test Client code
from xmlrpc.client import ServerProxy
s = ServerProxy('http://localhost:15000', allow_none = True)
s.set( 'foo', 'bar')
s.set( 'spam', [1, 2, 3])
s.keys()
#['foo', 'spam']
s.get('foo')
#'bar'
s.get('spam')
#[1, 2, 3]
s.delete('spam')
s.exists('spam')
#False
# Ex 11-7
from multiprocessing.connection import Listener
import traceback
def echo_client(conn):
try:
while True:
msg = conn.recv()
conn.send(msg)
except EOFError:
print( 'Connection closed')