Office365-REST-Python-Client: SSLCertVerificationError - AttributeError: 'NoneType' object has no attribute 'text'
Code worked completely fine and out of nowhere started giving me this error message: AttributeError: ‘NoneType’ object has no attribute ‘text’
Only other issues I can find online are for the Sharepy libary here on Github and here on Stack
Not sure what else can be tested on my end or what the Systems Admin can do to resolve this issue. If I could better target where to troubleshoot (login credentials, code to access, etc) that would be optimal.
The Systems Admin and I have tried using new credentials with no success, and I have also tried uninstalling and reinstalling the library, and testing on a new Python Environment, to no success.
Code used in script:
from office365.sharepoint.client_context import ClientContext
from office365.runtime.auth.client_credential import ClientCredential
client_credentials = ClientCredential(client_id,client_secret)
ctx = ClientContext(sitepath).with_credentials(client_credentials)
web = ctx.web
ctx.load(web)
ctx.execute_query()
The last line is where the error is thrown when I run it line by line.
Full error code:
SSLCertVerificationError Traceback (most recent call last)
[c:\Users\restoffilepath\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
702 # Make the request on the httplib connection object.
--> 703 httplib_response = self._make_request(
704 conn,
[c:\Users\restoffilepath\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
385 try:
--> 386 self._validate_conn(conn)
387 except (SocketTimeout, BaseSSLError) as e:
[c:\Users\restoffilepath\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
1039 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
-> 1040 conn.connect()
1041
[c:\Users\restoffilepath\lib\site-packages\urllib3\connection.py in connect(self)
415
--> 416 self.sock = ssl_wrap_socket(
417 sock=conn,
[c:\Users\restoffilepath\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
448 if send_sni:
--> 449 ssl_sock = _ssl_wrap_socket_impl(
...
---> 45 self.error = e.response.text
46 raise ValueError(e.response.text)
47
AttributeError: 'NoneType' object has no attribute 'text'
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 18 (2 by maintainers)
Hello @aayushkatariaa @ekoutsoff I actually ended up putting the entire project on backburner as this issue has no fix in sight. I’ve worked with my entire company IT and troubleshooted every issue we could have.
My plan is to use FME (Feature Manipulation Engine) by Safe Software to read the data from SharePoint. Just waiting on the license to do that.
My experience is exactly the same. Working completely fine for months before 3/14/2023, suddenly this exact same error. Occuring across multiple OSs such as Windows 10 and Windows Server 2016.
Code used in script:
Stack Trace:
@vgrem thanks for the response! I’ll have to double check nothing changed with Active Directory but that should be all set, and we’ve created new secret key and certificate so that is ruled out. To verify permissions, is that something done within Python? Apologies for lack of knowledge there. Cheers.