secret
Last active

  • Download Gist
suds.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
api = get_carrier('fedex', self.config)
#load Client and wsdl file:
# >>> api.client
# *** AttributeError: 'Fedex' object has no attribute 'client'
response = api.get_rates('78701', '78701', 2, 'GROUND')
# >>> api.client
# <suds.client.Client object at 0x10b6783d0>
# api.client is cloned each time when api.get_rates is called so it is thread safe
# and wsdl file is loaded only once.
 
if type_ == 'sync':
start = time.time()
for x in range(HOW_MANY):
response = api.get_rates('78701', '78701', 2, 'GROUND')
end = time.time()
elif type_ == 'single':
 
start = time.time()
response = api.get_rates('78701', '78701', 2, 'GROUND')
end = time.time()
else:
threads = []
start = time.time()
for x in range(HOW_MANY):
t = Thread(api)
t.start()
threads.append(t)
 
for t in threads:
t.join()
 
end = time.time()
 
a_time = end - start

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.