-
-
Save krotkiewicz/f741b05265ccc1927123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment