Skip to content

Commit 32b936e

Browse files
authored
Merge pull request #16 from tuneinsight/release-v1.1.4
v1.1.4 release
2 parents 60c55d2 + 97b4dce commit 32b936e

File tree

94 files changed

+4918
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4918
-74
lines changed

PKG-INFO

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: tuneinsight
3-
Version: 1.1.3
3+
Version: 1.1.4
44
Summary: Official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API.
55
License: Apache-2.0
66
Author: Tune Insight SA
@@ -29,6 +29,7 @@ Requires-Dist: pandas (>=2.2.3,<3.0.0)
2929
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
3030
Requires-Dist: python-dotenv (>=0.21.0,<0.22.0)
3131
Requires-Dist: python-keycloak
32+
Requires-Dist: requests (>=2.32.4)
3233
Requires-Dist: tornado (>=6.5.0,<7.0.0) ; extra == "full"
3334
Requires-Dist: tqdm (>=4.66.4,<5.0.0)
3435
Requires-Dist: typing-extensions (>=4.6.3,<5.0.0)

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tuneinsight"
3-
version = "1.1.3" # Ignored.
3+
version = "1.1.4" # Ignored.
44
description = "Official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API."
55
authors = ["Tune Insight SA"]
66
license = "Apache-2.0"
@@ -36,9 +36,10 @@ black = "24.2.0"
3636
httpx = ">=0.15.4,<0.28.0"
3737
attrs = ">=21.3.0"
3838
certifi = "^2024.07.04"
39-
jinja2 = "^3.1.6"
4039

4140
# Minimal versions required to fix known vulnerabilities in imports.
41+
requests = ">= 2.32.4"
42+
jinja2 = "^3.1.6"
4243
h11 = "^0.16.0"
4344
cryptography = "^44.0.1"
4445

src/tuneinsight/api/api-checksum

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e36e6c50fbaa6cc741561a596e346284fb9a161b523f0bdfacc4013a389e0d62
1+
491ea8ae3c034227264004fadf4d8bb0191b8df930e5a8ddd8d1a22992ba195b

src/tuneinsight/api/sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" A client library for accessing Tune Insight API """
1+
"""A client library for accessing Tune Insight API"""
22

33
from .client import AuthenticatedClient, Client
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
""" Contains methods for accessing the API """
1+
"""Contains methods for accessing the API"""
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import Client
8+
from ...models.computation import Computation
9+
from ...models.error import Error
10+
from ...types import UNSET, Response, Unset
11+
12+
13+
def _get_kwargs(
14+
computation_id: str,
15+
*,
16+
client: Client,
17+
notify_end: Union[Unset, None, bool] = UNSET,
18+
) -> Dict[str, Any]:
19+
url = "{}/computation/{computationId}".format(client.base_url, computationId=computation_id)
20+
21+
headers: Dict[str, str] = client.get_headers()
22+
cookies: Dict[str, Any] = client.get_cookies()
23+
24+
params: Dict[str, Any] = {}
25+
params["notifyEnd"] = notify_end
26+
27+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
28+
29+
# Set the proxies if the client has proxies set.
30+
proxies = None
31+
if hasattr(client, "proxies") and client.proxies is not None:
32+
https_proxy = client.proxies.get("https://")
33+
if https_proxy:
34+
proxies = https_proxy
35+
else:
36+
http_proxy = client.proxies.get("http://")
37+
if http_proxy:
38+
proxies = http_proxy
39+
40+
return {
41+
"method": "patch",
42+
"url": url,
43+
"headers": headers,
44+
"cookies": cookies,
45+
"timeout": client.get_timeout(),
46+
"proxies": proxies,
47+
"params": params,
48+
}
49+
50+
51+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Computation, Error]]:
52+
if response.status_code == HTTPStatus.OK:
53+
response_200 = Computation.from_dict(response.json())
54+
55+
return response_200
56+
if response.status_code == HTTPStatus.FORBIDDEN:
57+
response_403 = Error.from_dict(response.json())
58+
59+
return response_403
60+
if response.status_code == HTTPStatus.NOT_FOUND:
61+
response_404 = Error.from_dict(response.json())
62+
63+
return response_404
64+
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
65+
response_500 = Error.from_dict(response.json())
66+
67+
return response_500
68+
if client.raise_on_unexpected_status:
69+
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code} ({response})")
70+
else:
71+
return None
72+
73+
74+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Computation, Error]]:
75+
return Response(
76+
status_code=HTTPStatus(response.status_code),
77+
content=response.content,
78+
headers=response.headers,
79+
parsed=_parse_response(client=client, response=response),
80+
)
81+
82+
83+
def sync_detailed(
84+
computation_id: str,
85+
*,
86+
client: Client,
87+
notify_end: Union[Unset, None, bool] = UNSET,
88+
) -> Response[Union[Computation, Error]]:
89+
"""Modify editable attributes from a computation.
90+
91+
Args:
92+
computation_id (str):
93+
notify_end (Union[Unset, None, bool]):
94+
95+
Raises:
96+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97+
httpx.TimeoutException: If the request takes longer than Client.timeout.
98+
99+
Returns:
100+
Response[Union[Computation, Error]]
101+
"""
102+
103+
kwargs = _get_kwargs(
104+
computation_id=computation_id,
105+
client=client,
106+
notify_end=notify_end,
107+
)
108+
109+
response = httpx.request(
110+
verify=client.verify_ssl,
111+
**kwargs,
112+
)
113+
114+
return _build_response(client=client, response=response)
115+
116+
117+
def sync(
118+
computation_id: str,
119+
*,
120+
client: Client,
121+
notify_end: Union[Unset, None, bool] = UNSET,
122+
) -> Optional[Union[Computation, Error]]:
123+
"""Modify editable attributes from a computation.
124+
125+
Args:
126+
computation_id (str):
127+
notify_end (Union[Unset, None, bool]):
128+
129+
Raises:
130+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131+
httpx.TimeoutException: If the request takes longer than Client.timeout.
132+
133+
Returns:
134+
Response[Union[Computation, Error]]
135+
"""
136+
137+
return sync_detailed(
138+
computation_id=computation_id,
139+
client=client,
140+
notify_end=notify_end,
141+
).parsed
142+
143+
144+
async def asyncio_detailed(
145+
computation_id: str,
146+
*,
147+
client: Client,
148+
notify_end: Union[Unset, None, bool] = UNSET,
149+
) -> Response[Union[Computation, Error]]:
150+
"""Modify editable attributes from a computation.
151+
152+
Args:
153+
computation_id (str):
154+
notify_end (Union[Unset, None, bool]):
155+
156+
Raises:
157+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
158+
httpx.TimeoutException: If the request takes longer than Client.timeout.
159+
160+
Returns:
161+
Response[Union[Computation, Error]]
162+
"""
163+
164+
kwargs = _get_kwargs(
165+
computation_id=computation_id,
166+
client=client,
167+
notify_end=notify_end,
168+
)
169+
170+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
171+
response = await _client.request(**kwargs)
172+
173+
return _build_response(client=client, response=response)
174+
175+
176+
async def asyncio(
177+
computation_id: str,
178+
*,
179+
client: Client,
180+
notify_end: Union[Unset, None, bool] = UNSET,
181+
) -> Optional[Union[Computation, Error]]:
182+
"""Modify editable attributes from a computation.
183+
184+
Args:
185+
computation_id (str):
186+
notify_end (Union[Unset, None, bool]):
187+
188+
Raises:
189+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
190+
httpx.TimeoutException: If the request takes longer than Client.timeout.
191+
192+
Returns:
193+
Response[Union[Computation, Error]]
194+
"""
195+
196+
return (
197+
await asyncio_detailed(
198+
computation_id=computation_id,
199+
client=client,
200+
notify_end=notify_end,
201+
)
202+
).parsed

0 commit comments

Comments
 (0)