Skip to content

Commit 0667750

Browse files
authored
Merge pull request #978 from tableau/clarify-http-options
Add section about handling SSL certificates for Tableau Server
2 parents 3f02bc6 + d4a3cc2 commit 0667750

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

docs/sign-in-out.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ Name | Description
2828
TOKEN_NAME | The personal access token name (from the My Account settings page)
2929
TOKEN_VALUE | The personal access token value (from the My Account settings page)
3030
**Tableau Server** |
31-
SITENAME | The Tableau Server site you are authenticating with; for example in the site URL http://MyServer/#/site/MarketingTeam/projects, the site name is MarketingTeam; in the REST API documentation this field is also referred to as contentUrl; this value can be omitted to connect with the Default site on the server
32-
SERVER_URL | The Tableau Server you are authenticating with; if your server has SSL enabled, this should be an HTTPS link
31+
SITENAME | The Tableau Server site you are authenticating with. For example in the site URL http://MyServer/#/site/MarketingTeam/projects, the site name is MarketingTeam. In the REST API documentation, this field is also referred to as contentUrl. This value can be omitted to connect with the Default site on the server.
32+
SERVER_URL | The Tableau Server you are authenticating with. If your server has SSL enabled, this should be an HTTPS link.
3333
**Tableau Online** |
34-
SITENAME | The Tableau Online site you are authenticating with; for example in the site URL https://10ay.online.tableau.com/#/site/umbrellacorp816664/workbooks, the site name is umbrellacorp816664; in the REST API documentation this field is also referred to as contentUrl; this value is always required when connecting to Tableau Online
35-
SERVER_URL | The Tableau Online instance you are authenticating with; in the example above the server URL would be https://10ay.online.tableau.com; this will always be an an HTTPS link
34+
SITENAME | The Tableau Online site you are authenticating with. For example in the site URL https://10ay.online.tableau.com/#/site/umbrellacorp816664/workbooks, the site name is umbrellacorp816664. In the REST API documentation, this field is also referred to as contentUrl. This value is always required when connecting to Tableau Online.
35+
SERVER_URL | The Tableau Online instance you are authenticating with. In the example above the server URL would be https://10ay.online.tableau.com. This will always be an an HTTPS link.
3636

3737
This example illustrates using the above values to sign in with a personal access token, do some operations, and then sign out:
3838

@@ -73,6 +73,29 @@ server.auth.sign_in(tableau_auth)
7373
server.auth.sign_out()
7474
```
7575

76+
### Handling SSL certificates for Tableau Server
77+
78+
If you're connecting to a Tableau Server instance that uses self-signed or non-public SSL certificates, you may need to provide those as part of the sign in process. An example of this could be an on-premise Tableau Server that is using internally-generated SSL certificates. You may see an error like `SSL: CERTIFICATE_VERIFY_FAILED` if you connect with a Tableau Server but don't have the SSL certificates configured correctly.
79+
80+
The solution here is to call `server.add_http_options()` and include the local path containing the SSL certificate file:
81+
82+
```py
83+
import tableauserverclient as TSC
84+
85+
tableau_auth = TSC.PersonalAccessTokenAuth('TOKEN_NAME', 'TOKEN_VALUE', 'SITENAME')
86+
server = TSC.Server('https://SERVER_URL', use_server_version=True)
87+
server.add_http_options({'verify': '/path/to/certfile.pem'})
88+
server.auth.sign_in(tableau_auth)
89+
90+
# Do awesome things here!
91+
92+
server.auth.sign_out()
93+
```
94+
95+
The TSC library uses the Python Requests library under the hood, so you can learn more about the `verify` option on the [Python Requests advanced usage](https://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification) documentation.
96+
97+
You can also set `verify` to `False` to disable the SSL certificate verification step, but this is only useful for development and _should not be used for real production work_.
98+
7699
### 405000 Method Not Allowed Response
77100

78101
In some cases, you may find that sign in fails with a 405 message:

0 commit comments

Comments
 (0)