How to make oauth2 and api call work in python?

I’m trying to get the users list on my workspace with that api link using python.

But I’m probably doing something wrong. I’m trying to follow this tutorial. Can someone tell me what is wrong and how I can make it to work, please?

Here is the code i’m trying to run:

import requests
import json


# requesting an token:
data = { 'grant_type': 'client_credentials'}
response =, data=data, auth=CONSUMER_KEY,CONSUMER_SECRET))
payload = json.loads(response.text)

#Using token to make the request
access_token = payload['access_token']
header = {
  'Authorization': f'Bearer {access_token}'

workspace = 'myworkspace'
endpoint = f'{workspace}/members'

response = requests.get(endpoint, data=header)

<Response [401]>

Hi @paulosilva
Have you found a solution for the integration?