Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 03:50 PM
issue is with data/json...
try the below -
from azure.identity import DefaultAzureCredential
import requests
default_scope = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default"
credential = DefaultAzureCredential()
token = credential.get_token(default_scope)
access_token = str(token.token)
url="https://adb-xxxxx.azuredatabricks.net/api/2.0/workspace/mkdirs"
headers={"Authorization":"Bearer "+access_token, "Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(
url=url,
headers=headers,
data = '{"path":"/dpaas-ids2/test"}'
)
print(response)