i have some url where i need to do web crawling and it is protected by azure SAML protected. i have got the access token but still, request.get method return me to the redirected SAML login page content i use python masl library for azure SAML authentication.
import requests
http_proxy = "http://my proxy setting here"
https_proxy = "http://my proxy setting here"
proxyDict = {
"http": http_proxy,
"https": https_proxy,
}
app = ConfidentialClientApplication(
"my azure client id here",
"my azure sceret id here",
authority="https://login.microsoftonline.com/my tenat id here", proxies=proxyDict)
user = 'myuser@hotmail.com'
pwd = 'mypassword'
scope=['User.Read']
access_token = app.acquire_token_by_username_password(username=user, password=pwd,
scopes=scope)
url = 'https://my web site where i need to do crawling'
api_head = {'Authorization': 'Bearer ' + access_token['access_token']}
response = requests.get(url, proxies=proxyDict, headers=api_head)
but in return i get the login page url content only not the page i requested. also if i try to use some Microsoft graph that work fine and return the data. Not sure what is wrong in this flow any help is appreciated.
Thanks in advance..
from python request and MSL is not working with azure protected URL
No comments:
Post a Comment