我一直在尝试使用ebay shopping api并继续收到相同的错误。在这一点上,我只是尝试在ebay-sdk github页面上列出的示例代码,它仍然无法正常工作:
from ebaysdk.shopping import Connection as Shopping
from ebaysdk.exception import ConnectionError
try:
api = Shopping()
response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})
print(response.dict())
print(response.reply)
except ConnectionError as e:
print(e)
print(e.response.dict())
无论我尝试什么电话,它都会返回以下错误:
TypeError: sequence item 0: expected string, int found.
考虑到我即将放弃,任何关于我做错事的澄清都会很精彩。如果有帮助,这是追溯:
Traceback (most recent call last):
File "C:/Users/Scott/Documents/Dropbox/python_code/get_ebay_item_info/get_ebay_item_info.py", line 7, in <module>
response = api.execute('FindPopularItems', {'QueryKeywords': 'Python'})
File "C:\Python27\lib\site-packages\ebaysdk-2.1.2-py2.7.egg\ebaysdk\connection.py", line 119, in execute
self.execute_request()
File "C:\Python27\lib\site-packages\ebaysdk-2.1.2-py2.7.egg\ebaysdk\connection.py", line 184, in execute_request
allow_redirects=True
File "C:\Python27\lib\site-packages\requests-2.7.0-py2.7.egg\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests-2.7.0-py2.7.egg\requests\adapters.py", line 370, in send
timeout=timeout
File "C:\Python27\lib\site-packages\requests-2.7.0-py2.7.egg\requests\packages\urllib3\connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "C:\Python27\lib\site-packages\requests-2.7.0-py2.7.egg\requests\packages\urllib3\connectionpool.py", line 349, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Python27\lib\httplib.py", line 946, in request
self._send_request(method, url, body, headers)
File "C:\Python27\lib\httplib.py", line 986, in _send_request
self.putheader(hdr, value)
File "C:\Python27\lib\httplib.py", line 924, in putheader
str = '%s: %s' % (header, '\r\n\t'.join(values))
TypeError: sequence item 0: expected string, int found