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
CodePudding user response:
theses are not params but headers replace params=payload by:
{headers: {'Content-Type': 'application/json', Authorization : 'Bearer ' token}}