Skip to content

Commit fdc24b6

Browse files
authored
Publish 13.3.3 on PyPI (#316)
* Sync sources * Release metadata
1 parent 5fb9163 commit fdc24b6

9 files changed

+46
-73
lines changed

HISTORY.txt

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ Changelog
22
==========
33

44

5+
13.3.3 (2025-01-27)
6+
---------------------
7+
8+
* Initial release for DSS 13.3.3
59

610
13.3.2 (2025-01-15)
711
---------------------

dataikuapi/apinode_client.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import warnings
2-
3-
from .utils import DataikuException
42
from .base_client import DSSBaseClient
53

6-
74
class APINodeClient(DSSBaseClient):
85
"""Entry point for the DSS API Node client
96
This is an API client for the user-facing API of DSS API Node server (user facing API)

dataikuapi/base_client.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from requests import exceptions
55
from requests.auth import HTTPBasicAuth
66
from .auth import HTTPBearerAuth
7-
from .utils import DataikuException
7+
from .utils import handle_http_exception
88

99
class DSSBaseClient(object):
1010
def __init__(self, base_uri, api_key=None, internal_ticket=None, bearer_token=None, no_check_certificate=False, **kwargs):
@@ -36,16 +36,12 @@ def _perform_http(self, method, path, params=None, body=None, stream=False):
3636
elif self.bearer_token:
3737
auth = HTTPBearerAuth(self.bearer_token)
3838

39-
try:
40-
http_res = self._session.request(
39+
http_res = self._session.request(
4140
method, "%s/%s" % (self.base_uri, path),
4241
params=params, data=body, headers=headers,
4342
auth=auth, stream = stream)
44-
http_res.raise_for_status()
45-
return http_res
46-
except exceptions.HTTPError:
47-
ex = http_res.json()
48-
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
43+
handle_http_exception(http_res)
44+
return http_res
4945

5046
def _perform_empty(self, method, path, params=None, body=None):
5147
self._perform_http(method, path, params, body, False)

dataikuapi/dss/analysis.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from ..utils import DataikuException
21
from ..utils import DataikuUTF8CSVReader
32
from ..utils import DataikuStreamedHttpUTF8CSVReader
43
import json

dataikuapi/dssclient.py

+15-25
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from .dss.utils import DSSInfoMessages, Enum
3333
from .dss.workspace import DSSWorkspace
3434
import os.path as osp
35-
from .utils import DataikuException, dku_basestring_type
35+
from .utils import dku_basestring_type, handle_http_exception
3636
from .govern_client import GovernClient
3737

3838

@@ -1503,21 +1503,14 @@ def _perform_http(self, method, path, params=None, body=None, stream=False, file
15031503
if raw_body is not None:
15041504
body = raw_body
15051505

1506-
try:
1507-
http_res = self._session.request(
1508-
method, "%s/dip/publicapi%s" % (self.host, path),
1509-
params=params, data=body,
1510-
files=files,
1511-
stream=stream,
1512-
headers=headers)
1513-
http_res.raise_for_status()
1514-
return http_res
1515-
except exceptions.HTTPError:
1516-
try:
1517-
ex = http_res.json()
1518-
except ValueError:
1519-
ex = {"message": http_res.text}
1520-
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("detailedMessage", ex.get("message", "No message"))))
1506+
http_res = self._session.request(
1507+
method, "%s/dip/publicapi%s" % (self.host, path),
1508+
params=params, data=body,
1509+
files=files,
1510+
stream=stream,
1511+
headers=headers)
1512+
handle_http_exception(http_res)
1513+
return http_res
15211514

15221515
def _perform_empty(self, method, path, params=None, body=None, files = None, raw_body=None):
15231516
self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body)
@@ -1532,15 +1525,12 @@ def _perform_raw(self, method, path, params=None, body=None,files=None, raw_body
15321525
return self._perform_http(method, path, params=params, body=body, files=files, stream=True, raw_body=raw_body)
15331526

15341527
def _perform_json_upload(self, method, path, name, f):
1535-
try:
1536-
http_res = self._session.request(
1537-
method, "%s/dip/publicapi%s" % (self.host, path),
1538-
files = {'file': (name, f, {'Expires': '0'})} )
1539-
http_res.raise_for_status()
1540-
return http_res
1541-
except exceptions.HTTPError:
1542-
ex = http_res.json()
1543-
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
1528+
http_res = self._session.request(
1529+
method, "%s/dip/publicapi%s" % (self.host, path),
1530+
files = {'file': (name, f, {'Expires': '0'})} )
1531+
1532+
handle_http_exception(http_res)
1533+
return http_res
15441534

15451535
########################################################
15461536
# Discussions

dataikuapi/fmclient.py

+6-17
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os.path as osp
66
import warnings
77

8-
from .utils import DataikuException
8+
from .utils import handle_http_exception
99

1010
from .iam.settings import FMSSOSettings, FMLDAPSettings, FMAzureADSettings
1111

@@ -360,29 +360,18 @@ def _perform_http(
360360
body = json.dumps(body)
361361
if raw_body is not None:
362362
body = raw_body
363-
try:
364-
http_res = self._session.request(
363+
364+
365+
http_res = self._session.request(
365366
method,
366367
"%s/api/public%s" % (self.host, path),
367368
params=params,
368369
data=body,
369370
files=files,
370371
stream=stream,
371372
)
372-
http_res.raise_for_status()
373-
return http_res
374-
except exceptions.HTTPError:
375-
try:
376-
ex = http_res.json()
377-
except ValueError:
378-
ex = {"message": http_res.text}
379-
raise DataikuException(
380-
"%s: %s"
381-
% (
382-
ex.get("errorType", "Unknown error"),
383-
ex.get("message", "No message"),
384-
)
385-
)
373+
handle_http_exception(http_res)
374+
return http_res
386375

387376
def _perform_empty(
388377
self, method, path, params=None, body=None, files=None, raw_body=None

dataikuapi/govern_client.py

+7-18
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from dataikuapi.govern.custom_page import GovernCustomPageListItem, GovernCustomPage
1818
from dataikuapi.govern.time_series import GovernTimeSeries
1919
from dataikuapi.govern.uploaded_file import GovernUploadedFile
20-
from dataikuapi.utils import DataikuException
20+
from dataikuapi.utils import handle_http_exception
2121

2222

2323
class GovernClient(object):
@@ -62,21 +62,14 @@ def _perform_http(self, method, path, params=None, body=None, stream=False, file
6262
if raw_body is not None:
6363
body = raw_body
6464

65-
try:
66-
http_res = self._session.request(
65+
http_res = self._session.request(
6766
method, "%s/dip/publicapi%s" % (self.host, path),
6867
params=params, data=body,
6968
files=files,
7069
stream=stream,
7170
headers=headers)
72-
http_res.raise_for_status()
73-
return http_res
74-
except exceptions.HTTPError:
75-
try:
76-
ex = http_res.json()
77-
except ValueError:
78-
ex = {"message": http_res.text}
79-
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
71+
handle_http_exception(http_res)
72+
return http_res
8073

8174
def _perform_empty(self, method, path, params=None, body=None, files=None, raw_body=None):
8275
self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body)
@@ -91,15 +84,11 @@ def _perform_raw(self, method, path, params=None, body=None, files=None, raw_bod
9184
return self._perform_http(method, path, params=params, body=body, files=files, stream=True, raw_body=raw_body)
9285

9386
def _perform_json_upload(self, method, path, name, f):
94-
try:
95-
http_res = self._session.request(
87+
http_res = self._session.request(
9688
method, "%s/dip/publicapi%s" % (self.host, path),
9789
files={'file': (name, f, {'Expires': '0'})})
98-
http_res.raise_for_status()
99-
return http_res
100-
except exceptions.HTTPError:
101-
ex = http_res.json()
102-
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
90+
handle_http_exception(http_res)
91+
return http_res
10392

10493
########################################################
10594
# Blueprint Designer

dataikuapi/utils.py

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
class DataikuException(Exception):
2323
"""Exception launched by the Dataiku API clients when an error occurs"""
2424

25+
def handle_http_exception(http_res):
26+
if http_res.status_code >= 400:
27+
try:
28+
ex = http_res.json()
29+
except ValueError:
30+
ex = {"message": http_res.text}
31+
raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("detailedMessage", ex.get("message", "No message"))))
32+
33+
2534
class DataikuUTF8CSVReader(object):
2635
"""
2736
A CSV reader which will iterate over lines in the CSV file "f",

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import setup
44

5-
VERSION = "13.3.2"
5+
VERSION = "13.3.3"
66

77
long_description = (open('README').read() + '\n\n' +
88
open('HISTORY.txt').read())

0 commit comments

Comments
 (0)