Skip to content

Commit e2c1b05

Browse files
authored
Merge pull request #29 from splitio/3.5.6-fix_http_err_msg_and_traffic_type_microclient
3.5.6 fix http err msg and traffic type microclient
2 parents 3cd460e + b7608c6 commit e2c1b05

File tree

13 files changed

+811
-84
lines changed

13 files changed

+811
-84
lines changed

CHANGES.txt

Lines changed: 484 additions & 52 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include README.md
2+
include CHANGES.txt
3+
include LICENSE

check_package_contents.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

examples/error_handling_example.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

pyproject.toml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "splitapiclient"
7-
version = "3.5.5"
8-
description = "This Python Library provide full support for Split REST Admin API, allow creating, deleting and editing Environments, Splits, Split Definitions, Segments, Segment Keys, Users, Groups, API Keys, Change Requests, Attributes and Identities"
7+
version = "3.5.6"
8+
description = "This Python Library provides full support for Split REST Admin API, allow creating, deleting and editing Environments, Splits, Split Definitions, Segments, Segment Keys, Users, Groups, API Keys, Change Requests, Attributes and Identities"
99
classifiers = [
1010
"Programming Language :: Python :: 3",
1111
"Operating System :: OS Independent",
12-
"Development Status :: 3 - Alpha",
12+
"Development Status :: 5 - Production/Stable",
1313
"Environment :: Console",
1414
"Intended Audience :: Developers",
1515
"Programming Language :: Python :: 3",
@@ -25,9 +25,23 @@ maintainers = [
2525
{name = "Josh Klein", email = "[email protected]"}
2626
]
2727
dependencies = [
28-
'argparse >= 1.1',
29-
'requests >= 2.14.2',
30-
'six >= 1.10.0',
28+
"argparse >= 1.1",
29+
"requests >= 2.14.2",
30+
"six >= 1.10.0",
31+
]
32+
33+
[project.optional-dependencies]
34+
test = [
35+
"pytest >= 6.2.4",
36+
"pytest-mock >= 1.6.0",
37+
"mock >= 2.0.0",
38+
]
39+
dev = [
40+
"pytest >= 6.2.4",
41+
"pytest-mock >= 1.6.0",
42+
"mock >= 2.0.0",
43+
"build >= 0.7.0",
44+
"twine >= 3.4.0",
3145
]
3246

3347
[project.license]
@@ -51,22 +65,7 @@ addopts = "--verbose"
5165
[tool.setuptools]
5266
include-package-data = false
5367

54-
[aliases]
55-
test = "pytest"
56-
57-
[tool.pytest]
58-
addopts = "--verbose"
59-
60-
[options]
61-
packages = "find:"
62-
setup_requires = "pytest-runner"
63-
64-
[options.install_requires]
65-
"argparse>" = "1.1"
66-
"requests>" = "2.14.2"
67-
"six>" = "1.10.0"
68-
69-
[options.tests_require]
70-
mock = "=2.0.0"
71-
pytest-mock = "=1.6.0"
72-
pytest = "=6.2.4"
68+
[tool.setuptools.packages.find]
69+
where = ["."]
70+
include = ["splitapiclient*"]
71+
exclude = ["splitapiclient.tests*"]

splitapiclient/http_clients/harness_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ def _handle_invalid_response(self, response):
125125
400: HTTPIncorrectParametersError,
126126
}
127127

128+
# Format error message with status code
129+
error_message = f"HTTP {response.status_code}: {response.text}"
128130
exc = status_codes_exceptions.get(response.status_code)
129131
if exc:
130-
raise exc(response.text)
132+
raise exc(error_message, response)
131133
else:
132-
raise HTTPResponseError(response.text)
134+
raise HTTPResponseError(error_message, response)
133135

134136
def _handle_connection_error(self, e):
135137
'''

splitapiclient/http_clients/sync_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ def _handle_invalid_response(self, response):
5050
401: HTTPUnauthorizedError,
5151
400: HTTPIncorrectParametersError,
5252
}
53-
53+
# Format error message with status code
54+
error_message = f"HTTP {response.status_code}: {response.text}"
5455
exc = status_codes_exceptions.get(response.status_code)
5556
if exc:
56-
raise exc(response.text)
57+
raise exc(error_message, response)
5758
else:
58-
raise HTTPResponseError(response.text)
59+
raise HTTPResponseError(error_message, response)
5960

6061
def _handle_connection_error(self, e):
6162
'''

splitapiclient/microclients/traffic_type_microclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def list(self, workspace_id):
4949
self._endpoint['all_items'],
5050
workspaceId = workspace_id
5151
)
52-
return [TrafficType(item, self._http_client) for item in response]
52+
return [TrafficType(item, workspace_id, self._http_client) for item in response]
5353

5454
def find(self, traffic_type_name, workspace_id):
5555
'''

0 commit comments

Comments
 (0)