Reputation: 61
I'm trying to update a list located in an internal Sharepoint, using Shareplum/Python through Jenkins, but I'm getting the following error just from the connection to Sharepoint:
OSError: Tunnel connection failed: 502 Bad Gateway
During handling of the above exception, another exception occurred: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=Sharepoint, port=443): Max retries exceeded with url: Sharepoint/_vti_bin/Sites.asmx (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
During handling of the above exception, another exception occurred: requests.exceptions.ProxyError: HTTPSConnectionPool(host=Sharepoint, port=443): Max retries exceeded with url: Sharepoint/_vti_bin/Sites.asmx (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
During handling of the above exception, another exception occurred: shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : HTTPSConnectionPool(host=Sharepoint, port=443): Max retries exceeded with url: Sharepoint/_vti_bin/Sites.asmx (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
This is the way I'm trying to connect to Sharepoint:
from shareplum import Office365
from shareplum import Site
from shareplum.site import Version
from requests_negotiate_sspi import HttpNegotiateAuth
site = Site(<Sharepoint>, version=Version.v365, auth=HttpNegotiateAuth(), verify_ssl=False)
I've tried a lot of things, including updating the requests, shareplum and urllib3 packages, and adding version=Version.v365. Something to note is that running the script from a Python interpreter I'm able to update the list, but running the same script from Jenkins, I'm getting the mentioned error.
I'm using Python 3.7.3, and these are the version of the packages: requests 2.26.0, urllib3 1.25.11, shareplum 0.5.1, sharepoint 0.4.2
Note: In earlier versions of the script, verify_ssl=False
was added to manage the following error:
shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : HTTPSConnectionPool(host=Sharepoint, port=443): Max retries exceeded with url: Sharepoint/_vti_bin/Sites.asmx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)')))
Any thoughts?
Upvotes: 0
Views: 837
Reputation: 33
Just came across this researching a similar topic.
site = Site(SITE, auth=auth, verify_ssl=True, ssl_version='TLSv1')
Is what they say to use. Assuming your using Linux, this might be the solution.
https://shareplum.readthedocs.io/en/latest/advanced.html
Upvotes: 1