skip to Main Content

Recently, as I have tried to connect to make requests with the eBay finding SDK with python, I have been getting Connection errors. The error print does not state what is wrong.

This is the python script I wrote to make API requests.

from ebaysdk.finding import Connection as find_connect
import xmltodict

APP_ID = 'ActualID was removed-PRD-For privacy'
# keywords = input("Enter search keywords(e.g 'white board'): ")

api = find_connect(appid=APP_ID, config_file=None,  siteid="EBAY-ENCA")
request = {
        'keywords': "Iphone x 64gb",
        'itemFilter': [
            {'name': 'Condition', 'value': 'Used'},
            {'name': 'currency', 'value': 'CAD'},
            {'name': 'minPrice', 'value': 100.0}
        ],
        'paginationInput': {
            'entriesPerPage': 100,
            'pageNumber': 10
        },
    }

resp = api.execute('findItemsByKeywords', request).dict() # Change from XML to dictionary

When I run the script, I get this error

Traceback (most recent call last):
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 1322, in getresponse
    response.begin()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 303, in begin
    version, status, reason = self._read_status()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsocket.py", line 669, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesrequestsadapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3utilretry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3packagessix.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 1322, in getresponse
    response.begin()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 303, in begin
    version, status, reason = self._read_status()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsocket.py", line 669, in readinto
    return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Lase.Adebayo/PycharmProjects/eBay Data Collector/eBayCaller/ebay scripts/ebayxml.py", line 24, in <module>
    resp = api.execute('findItemsByKeywords', request).dict() # Change from XML to dictionary
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesebaysdkconnection.py", line 123, in execute
    self.execute_request()
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesebaysdkconnection.py", line 189, in execute_request
    self.response = self.session.send(self.request,
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesrequestssessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:UsersLase.AdebayoAppDataLocalProgramsPythonPython38-32libsite-packagesrequestsadapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

This same code worked about two weeks ago.

3

Answers


  1. Chosen as BEST ANSWER

    It seems that the python sdk devs are yet to change code from HTTP to HTTPS. You can use a YAML config file to specify https requests.

    svcs.ebay.com:
        appid: YOUR_APP_ID
        https: 1
    

  2. YAML configuration is needed if you want to make calls over https for version 2.1.5 of the SDK or earlier. 2.2.0+ will force all calls over https since eBay has moved completely to https.

    https://github.com/timotheus/ebaysdk-python/wiki/YAML-Configuration

    Login or Signup to reply.
  3. If you don’t want to use YAML, you can add a parameter to the api_call:

    For instance, here is the code that I use when not using a YAML in Python:

    api = finding(https=True, appid='your_app_id', config_file = None) 
    

    OR you could set https=1

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search