tableau / rest-api-samples

Samples for the Tableau REST API
MIT License
388 stars 272 forks source link

Python - SSL Certificate Error #36

Closed vhawx closed 2 years ago

vhawx commented 6 years ago

Hello tableau community,

I am trying to run the python code for the tableau rest api (specifically the User_Permission_Audit.py). However, I am encountering an SSL error. I believe I am supposed to add "no-certcheck" or set "verify=False" or something like that... but I am not quite sure. Do I incorporate something into the python code or into the terminal script?

Please advise, Victoria

ssl error

acknapp commented 5 years ago

Hi Victoria - I had this issue for myself as well. The issue is that the Tableau server you are trying to access was configured with a self signed certificate rather than one that is recognized by a certificate authority. The work around that I used (which seems to have worked) was to update the code I was calling for every get or post request statement to have an additional parameter of verify=False. for User_Permissions_Audit.py this would be lines 117, 141, 158, 181, 205, 240, 269. As an example line 117 currently looks like: server_response = requests.post(url, data=xml_requests) Updated it would look like this: server_response = requests.post(url, data=xml_requests, verify=False) Hope that helps!

jacalata commented 2 years ago

Correct, you can ignore SSL certificate checks by annotating a request to turn it off. You can also turn them off for the entire script like this:

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

This piece goes through it in detail: https://jcutrer.com/python/requests-ignore-invalid-ssl-certificates