When I make this REST API call in Postman it comes back with an access token
When I attempt it in Python using this code, I get this error
import os
import requests
import json
import jmespath
import pandas as pd
from pprint import pprint
from pyapacheatlas.auth import ServicePrincipalAuthentication
from pyapacheatlas.core import PurviewClient, AtlasEntity, AtlasProcess, TypeCategory
from pyapacheatlas.core.typedef import *
from pyspark.sql import *
from pyspark.sql.functions import *
from pyspark.sql.types import *
tenant_id = "tenant-id"
client_id = "client-id"
client_secret = "client-secret"
data_catalog_name = "catalog-name"
url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/token"
payload= f'grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}&resource={resource_url}'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
access_token = json.loads(response.text) #['access_token']
print(access_token)
Any suggestions what I'm doing wrong?