我在尝试将eBay finding sdk与python一起使用时遇到连接错误

我在尝试将eBay finding sdk与python一起使用时遇到连接错误,python,ebay-api,ebay-sdk,Python,Ebay Api,Ebay Sdk,最近,当我尝试使用带有python的eBay finding SDK进行连接以发出请求时,我遇到了连接错误。错误打印没有说明错误所在 这是我为发出API请求而编写的python脚本 from ebaysdk.finding import Connection as find_connect import xmltodict APP_ID = 'ActualID was removed-PRD-For privacy' # keywords = input("Enter search keywo

最近,当我尝试使用带有python的eBay finding SDK进行连接以发出请求时,我遇到了连接错误。错误打印没有说明错误所在

这是我为发出API请求而编写的python脚本

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
svcs.ebay.com:
    appid: YOUR_APP_ID
    https: 1
当我运行脚本时,我得到了这个错误

Traceback (most recent call last):
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1322, in getresponse
    response.begin()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\socket.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:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1322, in getresponse
    response.begin()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\socket.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:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ebaysdk\connection.py", line 123, in execute
    self.execute_request()
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ebaysdk\connection.py", line 189, in execute_request
    self.response = self.session.send(self.request,
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.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))

回溯(最近一次呼叫最后一次):
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\connectionpool.py”,第665行,在urlopen中
httplib\u response=self.\u发出请求(
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\urllib3\connectionpool.py”,第421行,在请求中
六、从(e,无)中提高
文件“”,第3行,从
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\connectionpool.py”,第416行,在请求中
httplib_response=conn.getresponse()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py”,第1322行,在getresponse中
response.begin()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py”,第303行,在begin中
版本、状态、原因=self.\u读取\u状态()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\http\client.py”,第264行,处于读取状态
line=str(self.fp.readline(_MAXLINE+1),“iso-8859-1”)
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\socket.py”,第669行,在readinto中
返回自我。将袜子重新放入(b)
ConnectionResetError:[WinError 10054]远程主机已强制关闭现有连接
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\requests\adapters.py”,第439行,在send中
resp=conn.urlopen(
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\connectionpool.py”,第719行,在urlopen中
重试次数=重试次数。增量(
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\util\retry.py”,第400行,增量
升起六个。重新升起(类型(错误),错误,_stacktrace)
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\urllib3\packages\six.py”,第734行,在reraise中
通过_回溯(tb)提升值
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\connectionpool.py”,第665行,在urlopen中
httplib\u response=self.\u发出请求(
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\urllib3\connectionpool.py”,第421行,在请求中
六、从(e,无)中提高
文件“”,第3行,从
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\urllib3\connectionpool.py”,第416行,在请求中
httplib_response=conn.getresponse()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py”,第1322行,在getresponse中
response.begin()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\http\client.py”,第303行,在begin中
版本、状态、原因=self.\u读取\u状态()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\http\client.py”,第264行,处于读取状态
line=str(self.fp.readline(_MAXLINE+1),“iso-8859-1”)
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\socket.py”,第669行,在readinto中
返回自我。将袜子重新放入(b)
urllib3.exceptions.ProtocolError:(“连接已中止”。,ConnectionResetError(10054,“远程主机强制关闭了现有连接”,无,10054,无))
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:/Users/Lase.Adebayo/PycharmProjects/eBay Data Collector/eBayCaller/eBay scripts/ebayxml.py”,第24行,在
resp=api.execute('findItemsByKeywords',request.dict()#将XML更改为字典
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python\Python38-32\lib\site packages\ebaysdk\connection.py”,执行中的第123行
self.execute_请求()
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\ebaysdk\connection.py”,第189行,在执行请求中
self.response=self.session.send(self.request,
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\requests\sessions.py”,第646行,在send中
r=适配器.send(请求,**kwargs)
文件“C:\Users\Lase.Adebayo\AppData\Local\Programs\Python38-32\lib\site packages\requests\adapters.py”,第498行,在send中
raise CONNECTIONERR(错误,请求=请求)
requests.exceptions.ConnectionError:(“连接已中止”。,ConnectionResetError(10054,“远程主机强制关闭了现有连接”,无,10054,无))

这段代码大约在两周前开始工作。

python sdk开发人员似乎还没有将代码从HTTP更改为HTTPS。您可以使用YAML配置文件指定HTTPS请求

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
svcs.ebay.com:
    appid: YOUR_APP_ID
    https: 1

python sdk开发人员似乎还没有将代码从HTTP更改为HTTPS。您可以使用YAML配置文件来指定HTTPS请求

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
svcs.ebay.com:
    appid: YOUR_APP_ID
    https: 1

如果您想通过https拨打SDK版本2.1.5或更早版本的电话,则需要YAML配置。2.2.0+将强制通过https拨打所有电话,因为易趣已完全改为https


如果您想通过https拨打SDK版本2.1.5或更早版本的电话,则需要YAML配置。由于易趣已完全改为https,2.2.0+将强制通过https拨打所有电话


如果不想使用YAML,可以向api_调用添加一个参数:

例如,以下是我在Python中不使用YAML时使用的代码:

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