I'm working on this Python script to upload file on a SharePoint :
from requests_ntlm import HttpNtlmAuth
from pypac import PACSession, get_pac
session = PACSession(get_pac(url='mypac.pac'))
headers = {
'Content-Type': 'application/json;odata=verbose',
'Accept': 'application/json;odata=verbose',
}
username = 'username'
password = 'password'
url = "https://my.sharepoint.com/path/_api/contextinfo"
request_result = session.get(url,
auth=HttpNtlmAuth(username, password),
headers=headers)
print(request_result)
Despite the fact that I have full permissions and no problem occured when I try manually with browsers, I always get 403 Forbidden error with the following message :
"Access denied. You do not have permission to perform this action or access this resource."
This script works well on two others SharePoint but not on this one.