@@ -32,6 +32,43 @@ def deprecate_site_attribute():
3232
3333# The traditional auth type: username/password
3434class TableauAuth (Credentials ):
35+ """
36+ The TableauAuth class defines the information you can set in a sign-in
37+ request. The class members correspond to the attributes of a server request
38+ or response payload. To use this class, create a new instance, supplying
39+ user name, password, and site information if necessary, and pass the
40+ request object to the Auth.sign_in method.
41+
42+ Parameters
43+ ----------
44+ username : str
45+ The user name for the sign-in request.
46+
47+ password : str
48+ The password for the sign-in request.
49+
50+ site_id : str, optional
51+ This corresponds to the contentUrl attribute in the Tableau REST API.
52+ The site_id is the portion of the URL that follows the /site/ in the
53+ URL. For example, "MarketingTeam" is the site_id in the following URL
54+ MyServer/#/site/MarketingTeam/projects. To specify the default site on
55+ Tableau Server, you can use an empty string '' (single quotes, no
56+ space). For Tableau Cloud, you must provide a value for the site_id.
57+
58+ user_id_to_impersonate : str, optional
59+ Specifies the id (not the name) of the user to sign in as. This is not
60+ available for Tableau Online.
61+
62+ Examples
63+ --------
64+ >>> import tableauserverclient as TSC
65+
66+ >>> tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD', site_id='CONTENTURL')
67+ >>> server = TSC.Server('https://SERVER_URL', use_server_version=True)
68+ >>> server.auth.sign_in(tableau_auth)
69+
70+ """
71+
3572 def __init__ (
3673 self , username : str , password : str , site_id : Optional [str ] = None , user_id_to_impersonate : Optional [str ] = None
3774 ) -> None :
@@ -55,6 +92,43 @@ def __repr__(self):
5592
5693# A Tableau-generated Personal Access Token
5794class PersonalAccessTokenAuth (Credentials ):
95+ """
96+ The PersonalAccessTokenAuth class defines the information you can set in a sign-in
97+ request. The class members correspond to the attributes of a server request
98+ or response payload. To use this class, create a new instance, supplying
99+ token name, token secret, and site information if necessary, and pass the
100+ request object to the Auth.sign_in method.
101+
102+ Parameters
103+ ----------
104+ token_name : str
105+ The name of the personal access token.
106+
107+ personal_access_token : str
108+ The personal access token secret for the sign in request.
109+
110+ site_id : str, optional
111+ This corresponds to the contentUrl attribute in the Tableau REST API.
112+ The site_id is the portion of the URL that follows the /site/ in the
113+ URL. For example, "MarketingTeam" is the site_id in the following URL
114+ MyServer/#/site/MarketingTeam/projects. To specify the default site on
115+ Tableau Server, you can use an empty string '' (single quotes, no
116+ space). For Tableau Cloud, you must provide a value for the site_id.
117+
118+ user_id_to_impersonate : str, optional
119+ Specifies the id (not the name) of the user to sign in as. This is not
120+ available for Tableau Online.
121+
122+ Examples
123+ --------
124+ >>> import tableauserverclient as TSC
125+
126+ >>> tableau_auth = TSC.PersonalAccessTokenAuth("token_name", "token_secret", site_id='CONTENTURL')
127+ >>> server = TSC.Server('https://SERVER_URL', use_server_version=True)
128+ >>> server.auth.sign_in(tableau_auth)
129+
130+ """
131+
58132 def __init__ (
59133 self ,
60134 token_name : str ,
@@ -88,6 +162,45 @@ def __repr__(self):
88162
89163# A standard JWT generated specifically for Tableau
90164class JWTAuth (Credentials ):
165+ """
166+ The JWTAuth class defines the information you can set in a sign-in
167+ request. The class members correspond to the attributes of a server request
168+ or response payload. To use this class, create a new instance, supplying
169+ an encoded JSON Web Token, and site information if necessary, and pass the
170+ request object to the Auth.sign_in method.
171+
172+ Parameters
173+ ----------
174+ token_name : str
175+ The name of the personal access token.
176+
177+ personal_access_token : str
178+ The personal access token secret for the sign in request.
179+
180+ site_id : str, optional
181+ This corresponds to the contentUrl attribute in the Tableau REST API.
182+ The site_id is the portion of the URL that follows the /site/ in the
183+ URL. For example, "MarketingTeam" is the site_id in the following URL
184+ MyServer/#/site/MarketingTeam/projects. To specify the default site on
185+ Tableau Server, you can use an empty string '' (single quotes, no
186+ space). For Tableau Cloud, you must provide a value for the site_id.
187+
188+ user_id_to_impersonate : str, optional
189+ Specifies the id (not the name) of the user to sign in as. This is not
190+ available for Tableau Online.
191+
192+ Examples
193+ --------
194+ >>> import jwt
195+ >>> import tableauserverclient as TSC
196+
197+ >>> jwt_token = jwt.encode(...)
198+ >>> tableau_auth = TSC.JWTAuth(token, site_id='CONTENTURL')
199+ >>> server = TSC.Server('https://SERVER_URL', use_server_version=True)
200+ >>> server.auth.sign_in(tableau_auth)
201+
202+ """
203+
91204 def __init__ (self , jwt : str , site_id : Optional [str ] = None , user_id_to_impersonate : Optional [str ] = None ) -> None :
92205 if jwt is None :
93206 raise TabError ("Must provide a JWT token when using JWT authentication" )
0 commit comments