Postman でこの REST API 呼び出しを行うと、アクセス トークンが返されます
。このコードを使用して Python で試行すると、このエラーが発生します。
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)
私が間違っていることは何か提案はありますか?