Skip to content
Chris Esposito edited this page Oct 15, 2021 · 9 revisions

Use the parallel class to execute concurrent API calls.

Usage

fromebaysdk.findingimportConnectionasFindingfromebaysdk.shoppingimportConnectionasShoppingfromebaysdk.parallelimportParallel# If you are using Python 3.x, make sure to import ebaysdk.parallel _before_ the other parts of the SDK.# Otherwise, you will get an exception when you call p.wait()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()
ifp.error():
raiseException(p.error())
printapi1.response.contentprintapi2.response.dict()
printapi3.response.dict()
printapi4.response.dict()
exceptConnectionErrorase:
raisee

Clone this wiki locally