timotheus / ebaysdk-python

eBay API SDK for Python
https://developer.ebay.com/tools/sdks
Other
808 stars 326 forks source link

requests FIndingAPI and ShoppingAPI taking too long #332

Open JuliGonzalez opened 4 years ago

JuliGonzalez commented 4 years ago

I have a process that has to handle around 500k product requests per day. In the past, the process was using the requests python library and not this SDK and the response received from eBay was fine. I decided to update this process to this SDK version for configuration and possible modifications the API can take in the future.

After some research, I found that the time it takes to do a request either using the FIndingAPI or the ShoppingAPI is really variable and takes x2 times than using the requests library.

The configuration for doing the Python call is the simplest: (I have tried changing configuration but hasn't solved anything). Python code:

shopping_api = Shopping(appid="EBAY_APP_ID",
                        siteid="EBAY-ES",
                        config_file=None)

_request_params = {
                'QueryKeywords':      gtin,
                "AvailableItemsOnly": True,
                "HideDuplicateItems": True,
            }
shopping_api.execute('FindProducts', data=_request_params)

These are some results from using both the requests python library and the ebaysdk: Successfully connected to eBay API version 1.13.0

measure_time.py:43 - INFO - Time doing request FindProducts with new build in 0.6939 s
measure_time.py:43 - INFO - Time doing request FindProducts with old build in 0.3747 s

measure_time.py:43 - INFO - Time doing request FindProducts with new build in 1.1578 s
measure_time.py:43 - INFO - Time doing request FindProducts with old build in 0.3853 s

Also some tests with around 400 products:

measure_time.py:43 - INFO - Did stuff with old build in 54.6816 s
measure_time.py:43 - INFO - Did stuff in 182.9920 s

As you can see, the requests library (old build) is always taking the same amount of time while this ebaysdk library time is highly changing.

Is there any reason why this is happening? Cheers, Juli.