Skip to content

Commit 99d63e5

Browse files
committed
list operations in ServiceProxy.__dir__ (used for auto-completion)
1 parent 6dce326 commit 99d63e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/zeep/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class OperationProxy(object):
1313
def __init__(self, service_proxy, operation_name):
1414
self._proxy = service_proxy
1515
self._op_name = operation_name
16+
self.__doc__ = 'OperationProxy for %s' % operation_name
1617

1718
def __call__(self, *args, **kwargs):
1819
"""Call the operation with the given args and kwargs.
@@ -66,6 +67,13 @@ def __getitem__(self, key):
6667
except ValueError:
6768
raise AttributeError('Service has no operation %r' % key)
6869
return OperationProxy(self, key)
70+
71+
def __dir__(self):
72+
""" Return the names of the operations. """
73+
return list(super(ServiceProxy, self).__dir__()
74+
+ list(self.__dict__)
75+
+ list(self._binding.port_type.operations))
76+
# using list() on the dicts for Python 3 compatibility
6977

7078

7179
class Factory(object):

0 commit comments

Comments
 (0)