我在使用 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 狀態的回應,我不明白該把令牌放在哪里
uj5u.com熱心網友回復:
這些不是引數,但標題將 params=payload 替換為:
{headers: {'Content-Type': 'application/json', Authorization : 'Bearer ' token}}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/484856.html
