如何将API打印与Django连接
我在与Django连接到Printify API时遇到了问题,我不是很实用,因此我需要理解为什么要通过参数
视图来传递的原因:
def home(request):
token = settings.TOKEN_PRINTIFY
headers = {'Content-Type': 'application/json', 'Authorization' : 'Bearer ' + token}
response = requests.get('https://api.printify.com/v1/shops', headers = headers)
print('-----------------', response) #error 404
context = {}
return render(request, 'home.html', context)
它的响应使我允许我401状态,我不明白在哪里放置那个象征
I have problems connecting to the printify api with django, I am not very practical so I would need to understand why and above all what to pass as parameters
views:
def home(request):
token = settings.TOKEN_PRINTIFY
headers = {'Content-Type': 'application/json', 'Authorization' : 'Bearer ' + token}
response = requests.get('https://api.printify.com/v1/shops', headers = headers)
print('-----------------', response) #error 404
context = {}
return render(request, 'home.html', context)
the response it gives me how 401 status and I don't understand where to put that token
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些不是参数,而是标题
替换
params =有效载荷
by:These are not params but headers
replace
params=payload
by: