pythondataframerestextracttableau-api

Python error when logging into Tableau server: 'Max retries exceeded with url: //api/2.4/auth/signin'


I'm trying to import/extract data from a workbook on Tableau server into Google Sheets. The first step is accessing the workbook on the server:

import tableauserverclient as TSC
import requests

tableau_auth = TSC.PersonalAccessTokenAuth('Token Name', 'Access Token', site_id='URL of workbook')
server = TSC.Server('server URL', use_server_version=True)
server.auth.sign_in(tableau_auth)

When I try this, I get the following error:

SSLError: HTTPSConnectionPool(host='Server URL', port=443): Max retries exceeded with url: //api/2.4/auth/signin (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

I tried tapping into the server and extracting the data into a pandas df.


Solution

  • See the docs for more info, but your site_id='URL of workbook' should be the site of your server not the URL of a workbook. It is the part of the server url coming after /site/.

    Example for Tableau Cloud:

    https://<MY_REGION>.online.tableau.com/#/site/<MY_SITE_ID>/
    

    If you are searching the default site use an empty string '' as your site_id. Once you authenticate with the correct site_id, you can then search through the workbook records.

    https://tableau.github.io/server-client-python/docs/api-ref#authentication