File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ def handle_future(future):
18
18
19
19
loop = asyncio .get_event_loop ()
20
20
21
- transport = AsyncTransport (cache = None )
22
- client = zeep .AsyncClient ("http://localhost:8000/?wsdl" , transport = transport )
21
+ client = zeep .AsyncClient ("http://localhost:8000/?wsdl" )
23
22
24
23
tasks = [
25
24
client .service .slow_request ("request-1" ), # takes 1 sec
@@ -32,7 +31,7 @@ def handle_future(future):
32
31
33
32
st = time .time ()
34
33
loop .run_until_complete (future )
35
- loop .run_until_complete (transport .aclose ())
34
+ loop .run_until_complete (client . transport .aclose ())
36
35
print ("time: %.2f" % (time .time () - st ))
37
36
print ("result: %s" , result )
38
37
print ("" )
Original file line number Diff line number Diff line change 3
3
4
4
from zeep .proxy import ServiceProxy , AsyncServiceProxy
5
5
from zeep .settings import Settings
6
- from zeep .transports import Transport
6
+ from zeep .transports import AsyncTransport , Transport
7
7
from zeep .wsdl import Document
8
8
9
9
logger = logging .getLogger (__name__ )
@@ -50,6 +50,8 @@ class Client:
50
50
:param settings: a zeep.Settings() object
51
51
52
52
"""
53
+ _default_transport = Transport
54
+
53
55
def __init__ (
54
56
self ,
55
57
wsdl ,
@@ -64,7 +66,7 @@ def __init__(
64
66
raise ValueError ("No URL given for the wsdl" )
65
67
66
68
self .settings = settings or Settings ()
67
- self .transport = transport if transport is not None else Transport ()
69
+ self .transport = transport if transport is not None else self . _default_transport ()
68
70
self .wsdl = Document (wsdl , self .transport , settings = self .settings )
69
71
self .wsse = wsse
70
72
self .plugins = plugins if plugins is not None else []
@@ -210,6 +212,7 @@ def _get_service(self, name: typing.Optional[str]) -> str:
210
212
211
213
212
214
class AsyncClient (Client ):
215
+ _default_transport = AsyncTransport
213
216
214
217
def bind (
215
218
self ,
You can’t perform that action at this time.
0 commit comments