Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Azure AD Graph API call
Azure AD Graph API - INIT
request_id = str(uuid.uuid4())
# url = 'https://graph.windows.net/{0}/{resource-path}?[query-parameters]'
url = 'https://graph.microsoft.com/me?v1.0'
tenant = 'lnodev.onmicrosoft.com'
headers = {
'User-Agent': 'python_tutorial/1.0',
'Accept': 'application/json',
'Authorization': 'Bearer %s' % token,
'Content-Type': 'application/json',
'client-request-id': request_id,
'return-client-request-id': 'true'
}
response = requests.post(url, headers=headers)
json_response = {"result": "An error occurred"}
json_response = response.json()
logging.info('GRAPH RESPONSE: %s' % response)
logging.info('GRAPH RESPONSE json: %s' % json_response)
Azure AD Graph API - END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.