Skip to content

Commit 4205c57

Browse files
Merge pull request #45 from thoughtspot/2.0.1
2.0.1
2 parents fd72c2c + 59242dd commit 4205c57

39 files changed

+54
-56
lines changed

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
*A simple and pythonic Python implementation of ThoughtSpot's REST APIs (both V1 and V2).*
2-
# LAST RELEASE NOTICE
3-
The 1.8.8 release will be the last under the `thoughtspot_rest_api_v1 / thoughtspot-rest-api-v1` package name.
1+
*A simple and pythonic Python implementation of ThoughtSpot's REST APIs (both V1 and V2.0).*
2+
# PACKAGE RENAME NOTICE
3+
The 2.N.N releases of `thoughtspot_rest_api` are a renamed continuation of the older `thoughtspot_rest_api_v1 / thoughtspot-rest-api-v1` packages.
44

5-
The package will transition to just `thoughtspot_rest_api / thoughtspot-rest-api` to reflect that V2.0 API is the primary API for ThoughtSpot. All code will remain the same other than the package name changing.
6-
7-
The repository itself will switch to a public / private mirror system at this time as well, which will break existing watching / forks.
5+
If you are using the `thoughtspot_rest_api_v1` package, please install `thoughtspot_rest_api` and update your import statements and everything should work. All new releases will be under this package name.
86

97
# README
108

11-
`thoughtspot_rest_api_v1` library implements the ThoughtSpot public REST APIs as directly as possible. It is not a "full SDK" with representation of each request and response type, but rather uses Python's Lists and Dicts for input and output.
9+
`thoughtspot_rest_api` library implements the ThoughtSpot public REST APIs as directly as possible. It is not a "full SDK" with representation of each request and response type, but rather uses Python's Lists and Dicts for input and output.
1210

1311
When using ThoughtSpot Cloud, always chose the V2.0 REST API via the `TSRestApiV2` class.
1412

@@ -28,9 +26,9 @@ Method and argument names closely match to the documented API endpoints, with a
2826
---
2927

3028
## Learning from the source code for V1
31-
At this point, if you have a need to use the V1 REST API, please use the TSRestApiV1 class. If you have some need for using the V1 REST API outside of Pyython, the library can be used a reference for how a V1 REST API endpoint is called correctly, look at the `/src/thoughtspot_rest_api_v1/tsrestapiv1.py` file. It contains the definition of all the ENUMs and the `TSRestApiV1` class.
29+
At this point, if you have a need to use the V1 REST API, please use the TSRestApiV1 class. If you have some need for using the V1 REST API outside of Pyython, the library can be used a reference for how a V1 REST API endpoint is called correctly, look at the `/src/thoughtspot_rest_api/tsrestapiv1.py` file. It contains the definition of all the ENUMs and the `TSRestApiV1` class.
3230

33-
Similarly, the `TSRestApiV2` class is defined in the `/src/thoughtspot_rest_api_v1/tsrestapiv2.py` file.
31+
Similarly, the `TSRestApiV2` class is defined in the `/src/thoughtspot_rest_api/tsrestapiv2.py` file.
3432

3533
The `TSRestApiV1` class uses the *requests* library to create an internal requests.Session object when the REST API sign-in command is run. This fulfils the ThoughtSpot REST API V1 requirement for session cookie details to be passed in every request.
3634

@@ -42,29 +40,29 @@ The library is designed to work with the latest version of ThoughtSpot Cloud. It
4240

4341
## Getting Started
4442

45-
To install thoughtspot_rest_api_v1, simply run this simple command in your terminal of choice:
43+
To install thoughtspot_rest_api, simply run this simple command in your terminal of choice:
4644

4745
```
48-
$ python3 -m pip install thoughtspot_rest_api_v1
46+
$ python3 -m pip install thoughtspot_rest_api
4947
```
5048

5149
### Getting the source code
5250

5351
```
54-
$ git clone https://github.com/thoughtspot/thoughtspot_rest_api_v1_python.git
52+
$ git clone https://github.com/thoughtspot/thoughtspot_rest_api_python.git
5553
```
5654

5755
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:
5856

5957
```
60-
$ cd thoughtspot_rest_api_v1_python
58+
$ cd thoughtspot_rest_api_python
6159
$ python3 -m pip install --upgrade
6260
```
6361

6462
---
6563

6664
## Importing the library
67-
from thoughtspot_rest_api_v1 import *
65+
from thoughtspot_rest_api import *
6866

6967
This will bring the `TSRestApiV1` and `TSRestApiV2` classes, as well as the following enumerations: `TSTypes`, `MetadataNames`, `MetadataSorts`, `MetadataSubtypes`, `MetadataCategories`, `ShareModes`, `Privileges`.
7068

@@ -94,7 +92,7 @@ REST API V2 allows for Bearer Token authentication, which is the preferred metho
9492
Next request a Full Access token using `auth_token_full()`. Get the `token` value from the response, then set the `bearer_token` property of the TSRestApiV2 object with the token. The object will keep the bearer token and use it in the headers of any subsequent call.
9593

9694

97-
from thoughtspot_rest_api_v1 import *
95+
from thoughtspot_rest_api import *
9896

9997
username = os.getenv('username') # or type in yourself
10098
password = os.getenv('password') # or type in yourself
@@ -110,7 +108,7 @@ Next request a Full Access token using `auth_token_full()`. Get the `token` valu
110108

111109
If you have requested an auth token from the REST API Playground, you can simply set the `bearer_token` property directly
112110

113-
from thoughtspot_rest_api_v1 import *
111+
from thoughtspot_rest_api import *
114112

115113
full_auth_token = '{token_from_playground}'
116114

examples/audit_object_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import requests.exceptions
44
import csv
55

6-
from thoughtspot_rest_api_v1 import *
6+
from thoughtspot_rest_api import *
77

88
# You are probably better of looking at https://github.com/thoughtspot/cs_tools for more complete versions of this
99
# functionality, but this shows how to use the REST APIs directly to put together various information in ways

examples/create_or_update_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import requests.exceptions
33
import json
44

5-
from thoughtspot_rest_api_v1 import *
5+
from thoughtspot_rest_api import *
66

77
#
88
# Short script to show how to use the connection_create and connection_update commands

examples/custom_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import requests
44

5-
from thoughtspot_rest_api_v1 import *
5+
from thoughtspot_rest_api import *
66

77
# Script to show using the /admin/ endpoints around Custom Actions
88
# Specific use-case shown is making an Action available on Context Menu of every viz on a Liveboard

examples/data_exports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import json
33

4-
from thoughtspot_rest_api_v1 import *
4+
from thoughtspot_rest_api import *
55

66

77
username = os.getenv('username') # or type in yourself

examples/delete_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import requests.exceptions
33

4-
from thoughtspot_rest_api_v1 import *
4+
from thoughtspot_rest_api import *
55

66
# This script uses the internal metadata/delete API endpoint, which will be unnecessary once the V2 API introduces
77
# a public form of delete. But it may be of use now

examples/import_tables_rest_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import requests.exceptions
33
import json
44

5-
from thoughtspot_rest_api_v1 import *
5+
from thoughtspot_rest_api import *
66

77

88
#

examples/liveboard_pdf_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import requests.exceptions
33

4-
from thoughtspot_rest_api_v1 import *
4+
from thoughtspot_rest_api import *
55

66

77
username = os.getenv('username') # or type in yourself

examples/objects_info_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import requests.exceptions
33

4-
from thoughtspot_rest_api_v1 import *
4+
from thoughtspot_rest_api import *
55

66

77
# Details about objects within ThoughtSpot all are accessed through 'metadata/' endpoints, which can be used

examples/share_objects_access_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import json
33

4-
from thoughtspot_rest_api_v1 import *
4+
from thoughtspot_rest_api import *
55

66

77
# You are probably better off looking at https://github.com/thoughtspot/cs_tools for more complete versions of this

0 commit comments

Comments
 (0)