Skip to content

Commit 19f1fe9

Browse files
committed
Merge branch 'master' of github.com:mvantellingen/python-zeep
2 parents 963001f + d27667b commit 19f1fe9

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/zeep/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ class OperationProxy(object):
1313
def __init__(self, service_proxy, operation_name):
1414
self._proxy = service_proxy
1515
self._op_name = operation_name
16+
try:
17+
signature = str(self._proxy._binding._operations[operation_name])
18+
self.__doc__ = signature
19+
except:
20+
self.__doc__ = 'OperationProxy for %s' % operation_name
1621

1722
def __call__(self, *args, **kwargs):
1823
"""Call the operation with the given args and kwargs.
@@ -66,6 +71,13 @@ def __getitem__(self, key):
6671
except ValueError:
6772
raise AttributeError('Service has no operation %r' % key)
6873
return OperationProxy(self, key)
74+
75+
def __dir__(self):
76+
""" Return the names of the operations. """
77+
return list(dir(super(ServiceProxy, self))
78+
+ list(self.__dict__)
79+
+ list(self._binding.port_type.operations))
80+
# using list() on the dicts for Python 3 compatibility
6981

7082

7183
class Factory(object):

src/zeep/tornado/transport.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def fetch(self, address, method, headers, message=None):
111111
'auth_username': auth_username,
112112
'auth_password': auth_password,
113113
'auth_mode': auth_mode,
114-
'validate_cert': self.session.verify,
114+
'validate_cert': self.session.verify is not None,
115+
'ca_certs': self.session.verify,
115116
'client_key': client_key,
116117
'client_cert': client_cert
117118
}

src/zeep/xsd/elements/element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def validate(self, value, render_path=None):
225225
path=render_path)
226226
elif self.max_occurs != 'unbounded' and len(value) > self.max_occurs:
227227
raise exceptions.ValidationError(
228-
"Expected at most %d items (maxOccurs check)" % self.min_occurs,
228+
"Expected at most %d items (maxOccurs check)" % self.max_occurs,
229229
path=render_path)
230230

231231
for val in value:

tests/test_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ def test_service_proxy_non_existing():
4343
assert client_obj.service.NonExisting
4444

4545

46+
def test_service_proxy_dir_operations():
47+
client_obj = client.Client('tests/wsdl_files/soap.wsdl')
48+
operations = [op for op in dir(client_obj.service) if not op.startswith('_')]
49+
assert set(operations) == set(['GetLastTradePrice', 'GetLastTradePriceNoOutput'])
50+
51+
52+
def test_operation_proxy_doc():
53+
client_obj = client.Client('tests/wsdl_files/soap.wsdl')
54+
assert (client_obj.service.GetLastTradePrice.__doc__
55+
== 'GetLastTradePrice(tickerSymbol: xsd:string, '
56+
'account: ns0:account, '
57+
'country: ns0:country) -> price: xsd:float')
58+
59+
4660
def test_open_from_file_object():
4761
with open('tests/wsdl_files/soap_transport_err.wsdl', 'rb') as fh:
4862
client_obj = client.Client(fh)

0 commit comments

Comments
 (0)