0
我想要继承Python 3.5.2的xmlrpc.client ServerProxy()以便自定义其与XML服务器的通信。但是,我受到ServerProxy如何命名其属性的阻碍。Python 3的xmlrpc.client ServerProxy()对象如何动态重命名它的属性?
属性在“XMLRPC/client.py”命名的很清楚:
class ServerProxy:
...
self.__transport = ...
self.__encoding = ...
self.__verbose = ...
...
然而,当我尝试以交互方式检查对象,该对象的属性是预先计划与“_ServerProxy”:
import xmlrpc.client
my_client = xmlrpc.client.ServerProxy('http://01.234.567.890')
my_client.__dict__
Out[3]:
{'_ServerProxy__allow_none': False,
'_ServerProxy__encoding': 'utf-8',
'_ServerProxy__handler': '/RPC2',
'_ServerProxy__host': '01.234.567.890:8000',
'_ServerProxy__transport': <xmlrpc.client.Transport at 0x1043c4320>,
'_ServerProxy__verbose': False}
代码中是如何/在哪里进行这个dynamica重命名?我想到我理解__getattr__()
和朋友,但我不能为我的生活找出这发生的地方。
啊,废话。你是对的。我忘了捣鼓。你是对的。这是一个骗局。谢谢Ignacio。 –