-
Notifications
You must be signed in to change notification settings - Fork 326
Parallel Class
Sven Hüster edited this page Apr 4, 2018
·
9 revisions
The parallel class can be used to execute concurrent API calls.
from ebaysdk.finding import Connection as Finding
from ebaysdk.shopping import Connection as Shopping
from ebaysdk.parallel import Parallel
try:
p = Parallel()
api1 = Shopping(parallel=p)
api1.execute('FindPopularItems', {'QueryKeywords': 'Python'})
api2 = Finding(parallel=p)
api2.execute('findItemsAdvanced', {'keywords': 'shoes'})
api3 = Finding(parallel=p)
api3.execute('findItemsAdvanced', {'keywords': 'shirts'})
api4 = Finding(parallel=p)
api4.execute('findItemsAdvanced', {'keywords': 'pants'})
p.wait()
if p.error():
raise Exception(p.error())
print api1.response.content
print api2.response.dict()
print api3.response.dict()
print api4.response.dict()
except ConnectionError as e:
raise e