Skip to content

Commit 3effb30

Browse files
committed
Release Aspose.Cells Cloud SDK 20.11
1 parent f607cb6 commit 3effb30

25 files changed

+71
-50
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![PyPI](https://img.shields.io/pypi/v/asposecellscloud) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/asposecellscloud) ![PyPI - Downloads](https://img.shields.io/pypi/dm/asposecellscloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-python)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-python/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-python/20.10)
1+
![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![PyPI](https://img.shields.io/pypi/v/asposecellscloud) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/asposecellscloud) ![PyPI - Downloads](https://img.shields.io/pypi/dm/asposecellscloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-python)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-python/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-python/20.11)
22

33

44
# Python SDK for Spreadsheet Processing in Cloud
@@ -21,10 +21,10 @@ Python Cloud SDK wraps Aspose.Cells REST API so you could seamlessly integrate M
2121
- Convert worksheets to PDF, XPS & SVG formats.
2222
- Inter-convert files to popular Excel formats.
2323

24-
## Enhancements in Version 20.10
24+
## Enhancements in Version 20.11
2525

26-
- Support to upload large file.
27-
- Enhancement for post sparkline group API.
26+
- Support Aspose.Cells Cloud for Docker.
27+
- Replace app sid to client id
2828

2929
## Read & Write Spreadsheet Formats
3030

@@ -68,7 +68,7 @@ Firstly, create an account at [Aspose for Cloud](https://dashboard.aspose.cloud/
6868
```python
6969

7070
#Instantiate Aspose Cells API SDK
71-
cellsApi = asposecellscloud.apis.cells_api.CellsApi(GetAPPSID(),GetAPPKey(),"v3.0")
71+
cellsApi = asposecellscloud.apis.cells_api.CellsApi(GetClientId(),GetClientSecret(),"v3.0")
7272

7373
templateFile ='Book1.xlsx'
7474
folder = "Temp"
@@ -88,7 +88,7 @@ Firstly, create an account at [Aspose for Cloud](https://dashboard.aspose.cloud/
8888

8989
```python
9090
#Instantiate Aspose Cells API SDK
91-
cellsApi = asposecellscloud.apis.cells_api.CellsApi(GetAPPSID(),GetAPPKey(),"v3.0")
91+
cellsApi = asposecellscloud.apis.cells_api.CellsApi(GetClientId(),GetClientSecret(),"v3.0")
9292

9393
fullfilename = os.path.dirname(os.path.realpath(__file__)) + "/../TestData/" + "Book1.xlsx"
9494
format ='pdf'

asposecellscloud/apis/cells_api.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,23 @@
3737

3838
class CellsApi(object):
3939

40-
def __init__(self,appsid, appkey, version='v3.0', base_uri= 'https://api.aspose.cloud', api_client=None):
41-
self.appsid = appsid
42-
self.appkey = appkey
40+
def __init__(self,clientid, clientsecret, version='v3.0', base_uri= 'https://api.aspose.cloud', api_client=None):
41+
self.clientid = clientid
42+
self.clientsecret = clientsecret
4343
self.version = version
4444
if base_uri[-1] == '/' :
4545
self.base_uri = base_uri[0:len(base_uri)-1]
4646
else:
4747
self.base_uri = base_uri
48-
48+
if not clientid or not clientsecret :
49+
self.needAuth = False
50+
else:
51+
self.needAuth = True
52+
4953
self.api_client = ApiClient(base_uri)
50-
self.access_token = self.api_client.get_access_token("client_credentials", appsid, appkey,version)
51-
# self.auth_data = self.o_auth_post("client_credentials", appsid, appkey)
54+
if self.needAuth :
55+
self.access_token = self.api_client.get_access_token("client_credentials", clientid, clientsecret,version)
56+
# self.auth_data = self.o_auth_post("client_credentials", clientid, clientsecret)
5257
config = Configuration()
5358
config.host = self.base_uri +'/' + self.version
5459
if api_client:
@@ -57,18 +62,20 @@ def __init__(self,appsid, appkey, version='v3.0', base_uri= 'https://api.aspose.
5762
if not config.api_client:
5863
config.api_client = ApiClient()
5964
self.api_client = config.api_client
60-
self.api_client.set_default_header("Authorization", "Bearer " + self.access_token)
65+
if self.needAuth :
66+
self.api_client.set_default_header("Authorization", "Bearer " + self.access_token)
6167
self.get_access_token_time = time.process_time()
6268
# self.api_client.set_default_header("Authorization", "Bearer " + self.auth_data.access_token)
6369

6470
def check_access_token(self):
65-
if self.access_token:
66-
timediff = time.process_time() - self.get_access_token_time
67-
if timediff > 86300 :
68-
api_client = ApiClient(self.base_uri)
69-
self.access_token = api_client.get_access_token("client_credentials", self.appsid, self.appkey,self.version)
70-
self.api_client.set_default_header("Authorization", "Bearer " + self.access_token)
71-
self.get_access_token_time = time.process_time()
71+
if self.needAuth :
72+
if self.access_token:
73+
timediff = time.process_time() - self.get_access_token_time
74+
if timediff > 86300 :
75+
api_client = ApiClient(self.base_uri)
76+
self.access_token = api_client.get_access_token("client_credentials", self.clientid, self.clientsecret,self.version)
77+
self.api_client.set_default_header("Authorization", "Bearer " + self.access_token)
78+
self.get_access_token_time = time.process_time()
7279

7380
def cells_auto_filter_delete_worksheet_date_filter(self, name, sheet_name, field_index, date_time_grouping_type, **kwargs):
7481
"""

test/AuthUtil.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,34 @@
1313

1414

1515
grantType = "client_credentials"
16-
clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx"
17-
clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
16+
clientId = os.getenv('CellsCloudTestClientId')
17+
clientSecret = os.getenv('CellsCloudTestClientSecret')
1818
def GetBaseUrl():
19-
return 'https://api-qa.aspose.cloud';
20-
def GetAPPSID():
19+
return os.getenv('CellsCloudTestApiBaseUrl')
20+
def GetClientId():
2121
return clientId
22-
def GetAPPKey():
22+
def GetClientSecret():
2323
return clientSecret
2424
def GetAccessToken():
25-
client = ApiClient('https://api-qa.aspose.cloud')
25+
client = ApiClient(GetBaseUrl())
2626
api = asposecellscloud.apis.cells_api.CellsApi(client)
2727
data = api.o_auth_post(grantType, clientId, clientSecret)
2828
return data.access_token
29-
29+
def GetAppUrl():
30+
appurl = GetBaseUrl()
31+
if not appurl.endswith('/'):
32+
appurl.append('/')
33+
appurl.append('v3.0')
34+
return appurl
35+
def IsDockerSDK():
36+
return True
37+
3038
api_client = None
3139

3240
def GetApiClient():
3341
global api_client
3442
if api_client == None:
35-
api_client = ApiClient('https://api-qa.aspose.cloud/v3.0')
43+
api_client = ApiClient(GetAppUrl())
3644
api_client.set_default_header("Authorization", "Bearer " + GetAccessToken())
3745
return api_client
3846

test/test_cells_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def setUp(self):
2525
warnings.simplefilter('ignore', ResourceWarning)
2626
global global_api
2727
if global_api is None:
28-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",'https://api-qa.aspose.cloud')
28+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
2929
self.api = global_api
3030

3131
def tearDown(self):

test/test_cells_auto_filter_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def setUp(self):
3737
warnings.simplefilter('ignore', ResourceWarning)
3838
global global_api
3939
if global_api is None:
40-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
40+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
4141
self.api = global_api
4242

4343
def tearDown(self):

test/test_cells_autoshapes_api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setUp(self):
2222
warnings.simplefilter('ignore', ResourceWarning)
2323
global global_api
2424
if global_api is None:
25-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
25+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
2626
self.api = global_api
2727

2828
def tearDown(self):
@@ -34,6 +34,8 @@ def test_cells_autoshapes_get_worksheet_autoshape(self):
3434
3535
Get autoshape info.
3636
"""
37+
if AuthUtil.IsDockerSDK():
38+
return
3739
name ='myDocument.xlsx'
3840
sheet_name ='Sheet2'
3941
autoshapeNumber = 4
@@ -50,6 +52,8 @@ def test_cells_autoshapes_get_worksheet_autoshape_format(self):
5052
5153
Get autoshape info.
5254
"""
55+
if AuthUtil.IsDockerSDK():
56+
return
5357
name ='myDocument.xlsx'
5458
sheet_name ='Sheet2'
5559
autoshapeNumber = 4
@@ -66,6 +70,8 @@ def test_cells_autoshapes_get_worksheet_autoshapes(self):
6670
6771
Get worksheet autoshapes info.
6872
"""
73+
if AuthUtil.IsDockerSDK():
74+
return
6975
name ='myDocument.xlsx'
7076
sheet_name ='Sheet2'
7177
folder = "PythonTest"

test/test_cells_chart_area_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setUp(self):
3333
warnings.simplefilter('ignore', ResourceWarning)
3434
global global_api
3535
if global_api is None:
36-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
36+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
3737
self.api = global_api
3838

3939
def tearDown(self):

test/test_cells_charts_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def setUp(self):
3535
warnings.simplefilter('ignore', ResourceWarning)
3636
global global_api
3737
if global_api is None:
38-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
38+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
3939
self.api = global_api
4040

4141

test/test_cells_conditional_formattings_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setUp(self):
3333
warnings.simplefilter('ignore', ResourceWarning)
3434
global global_api
3535
if global_api is None:
36-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
36+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
3737
self.api = global_api
3838

3939
def tearDown(self):

test/test_cells_hypelinks_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setUp(self):
3333
warnings.simplefilter('ignore', ResourceWarning)
3434
global global_api
3535
if global_api is None:
36-
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetAPPSID(),AuthUtil.GetAPPKey(),"v3.0",AuthUtil.GetBaseUrl())
36+
global_api = asposecellscloud.apis.cells_api.CellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
3737
self.api = global_api
3838

3939

0 commit comments

Comments
 (0)