Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有URL JSON对象的Python Ebay SDK必须是字符串错误_Python_Json_Python Requests_Ebay Api - Fatal编程技术网

带有URL JSON对象的Python Ebay SDK必须是字符串错误

带有URL JSON对象的Python Ebay SDK必须是字符串错误,python,json,python-requests,ebay-api,Python,Json,Python Requests,Ebay Api,我第一次尝试为eBay finding 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 "Re

我第一次尝试为eBay finding 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""
到目前为止,我的代码是:我正在使用易趣推荐方法的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()

EbaySdk不会向您返回该错误

requests.get返回响应对象,而不是字符串。loads需要字符串或字节,但您给了它一个响应

该响应对象有自己的json函数

info = requests.get(url)
doc = info.json()