[401] Access denied: Connecting python api

Hello friends,

I’m trying to use the MAKE API via Python, initially I’m retrieving the scenarios, then I want the hooks, my account is not the free one, I followed all the steps stated in the documentation, however, I only get the 401 return from the api even when performing the authentications.

I tried to access using “http.client” as indicated in the documentation, just changing the parameters, below is the code:

import http.client

conn = http.client.HTTPSConnection(“us1.make.com”)

headers = { ‘Authorization’: “Token 5b5xxxxx-cxx6-4xxx-xxxe-fcxxxxxxxxa8” }

conn.request(“GET”, “/api/v2/scenarios?teamId=127xxx&organizationId=3xxxxx&id%5B%5D=1%2C2%2C3&folderId=1&islinked=true&concept=true”, headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode(“utf-8”))

I performed the same procedure using requests, and I was also unsuccessful.

import requests

headers = { ‘Authorization’: “Token 5b5xxxxx-cxx6-4xxx-xxxe-fcxxxxxxxxa8” }

url_base = ‘https://us1.make.com
url = f’{url_base}/api/v2/scenarios?teamId=1xxx&organizationId=3xxxx&id%5B%5D=1%2C2%2C3&folderId=1&islinked=true&concept=true’

response = requests.get(url, headers=headers)

print(response)

I already searched here in the community and followed an indication from another post, I replaced “eu1.make.com” with “us1.make.com” and I was also unsuccessful.

Can anyone help me with resolving this problem?