You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue I am getting following error "Error: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /GetUserRealm.srf (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))"
I am trying to set the ssl-verify=none to get the poc moving, Any ideas on how I can do that with AuthenticationContext
Vadim helped in updating the function to include flag for SSL verification. Here is the information from stackoverflow
In the latest version RequestOptions.verify property is exposed which allows:
to control whether to verify the server's TLS certificate which accepts:
boolean value (defaults to True)
string value, which represents path to a CA bundle to use
Example
Certification verification could be disabled via underlying HTTP request object as demonstrated below:
ctx.get_pending_request().beforeExecute += disable_ssl
web = ctx.web
ctx.load(web)
ctx.execute_query()
print(web.properties["Url"])`
Note
Once disabled, urllib3 might complain with InsecureRequestWarning warning which is expected given unverified HTTPS request is being made to host {tenant}.sharepoint.com. Adding certificate verification is strongly advised.
Installation
Since it requires the latest version, it could be installed from GitHub (until it gets published in PyPI):
site-packages\urllib3\connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: urllib3.readthedocs.io/en/latest/… InsecureRequestWarning, Traceback (most recent call last): File "C:\LocalUser\AppData\Roaming\Python\Python37\site-packages\office365\runtime\client_request.py", line 36, in execute_query response.raise_for_status()
File "C:\LocalUser\AppData\Roaming\Python\Python37\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: MySharePointSiteURL/_api/Web During handling of the above exception, another exception occurred:
I have imported urllib3 and disabled warnings import urllib3 urllib3.disable_warnings()
After urllib3.disable_warnings() , I am getting similar error File "C:,,,,Python\Python37\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:
It is a SharePoint Online site.
Thanks
Nate
The text was updated successfully, but these errors were encountered:
I am trying a get a list items from SharePoint to Python, here is the code I am using for the poc
ctx_auth = AuthenticationContext(url='https://SharePointSiteURL') if ctx_auth.acquire_token_for_user(username='MyUser@Company.onmicrosoft.com',password='MyPassword'): ctx = ClientContext('https://SharePointSiteURL', ctx_auth) lists = ctx.web.lists ctx.load(lists)
The issue I am getting following error "Error: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /GetUserRealm.srf (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))"
I am trying to set the ssl-verify=none to get the poc moving, Any ideas on how I can do that with AuthenticationContext
Vadim helped in updating the function to include flag for SSL verification. Here is the information from stackoverflow
to control whether to verify the server's TLS certificate which accepts:
boolean value (defaults to True)
string value, which represents path to a CA bundle to use
Example
Certification verification could be disabled via underlying HTTP request object as demonstrated below:
`def disable_ssl(request):
request.verify = False # Disable certification verification
ctx = ClientContext.connect_with_credentials("https://contoso.sharepoint.com",
UserCredential(username,
password)
ctx.get_pending_request().beforeExecute += disable_ssl
web = ctx.web
ctx.load(web)
ctx.execute_query()
print(web.properties["Url"])`
Note
Once disabled, urllib3 might complain with InsecureRequestWarning warning which is expected given unverified HTTPS request is being made to host {tenant}.sharepoint.com. Adding certificate verification is strongly advised.
Installation
Since it requires the latest version, it could be installed from GitHub (until it gets published in PyPI):
pip install git+https://github.com/vgrem/Office365-REST-Python-Client.git
Issue I am facing
site-packages\urllib3\connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: urllib3.readthedocs.io/en/latest/… InsecureRequestWarning, Traceback (most recent call last): File "C:\LocalUser\AppData\Roaming\Python\Python37\site-packages\office365\runtime\client_request.py", line 36, in execute_query response.raise_for_status()
File "C:\LocalUser\AppData\Roaming\Python\Python37\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: MySharePointSiteURL/_api/Web During handling of the above exception, another exception occurred:
I have imported urllib3 and disabled warnings
import urllib3 urllib3.disable_warnings()
After urllib3.disable_warnings() , I am getting similar error File "C:,,,,Python\Python37\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:
It is a SharePoint Online site.
Thanks
Nate
The text was updated successfully, but these errors were encountered: