我正在使用django和python 3.我正在关注一个教程。但他正在使用旧版本。我得到错误:
JSON object must be str, not 'bytes'
这是我的views.py
import json
import urllib.request
locu_widget_key = "2c6860bd479198xxxxxxxxxxxxxxxxxx"
locu_api = "8e438723a7e87d0e47e9e7xxxxxxxxxxxxxxxxxx"
url = "https://api.locu.com/v1_0/venue/search/?api_key=8e438723a7e87d0e47e9e751d5d0dad00abd"
json_obj = urllib.request.urlopen(url)
data = json.load(json_obj)
reqx = request.META.get("HTTP_COOKIE")
title = "<h1>Scrape</h1>"
context = {
"site": "",
"title": title,
"links": myset,
"request": reqx,
"data": data
}
return render(request, "posts/display_soup.html", context)
我该怎么做才能做到这一点?欢迎任何帮助或指导