【发布时间】:2018-07-24 04:03:40
【问题描述】:
我第一次尝试为 eBay 查找 API 设置我的 Python 代码,但我被难住了。
我还没有打印或保存任何内容,因为代码无法运行。我收到以下错误:
"file: "C:\Users\juan\Anaconda3\lib\json\_init_.py", line 348, in loads
'not {!r}'.format(s._class_._name_))
typeError: the JSON object must be str, bytes or bytearry, not "Response""
到目前为止我的代码:(我使用的是 ebay 建议方法的“URL”版本)
from ebaysdk.finding import Connection as finding
from bs4 import BeautifulSoup
import json
import requests
url = "http://svcs.ebay.com/services/search/FindingService/v1\
?OPERATION-NAME=findCompletedItems&\
SERVICE-VERSION=1.7.0&\
SECURITY-APPNAME=12221222-121212121-111-11111111-111111111&\
RESPONSE-DATA-FORMAT=JSON&\
REST-PAYLOAD&\
GLOBAL-ID=EBAY-MOTOR&\
keywords=Garmin+nuvi+1300+Automotive+GPS+Receiver&\
categoryId=156955&\
itemFilter(0).name=Condition&\
itemFilter(0).value=3000&\
itemFilter(1).name=FreeShippingOnly&\
itemFilter(1).value=true&\
itemFilter(2).name=SoldItemsOnly&\
itemFilter(2).value=true&\
sortOrder=PricePlusShippingLowest&\
paginationInput.entriesPerPage=2"
info = requests.get(url)
doc = json.loads(info).decode()
【问题讨论】:
标签: python json python-requests ebay-api