Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: tuneinsight
Version: 1.1.3
Version: 1.1.4
Summary: Official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API.
License: Apache-2.0
Author: Tune Insight SA
Expand Down Expand Up @@ -29,6 +29,7 @@ Requires-Dist: pandas (>=2.2.3,<3.0.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Requires-Dist: python-dotenv (>=0.21.0,<0.22.0)
Requires-Dist: python-keycloak
Requires-Dist: requests (>=2.32.4)
Requires-Dist: tornado (>=6.5.0,<7.0.0) ; extra == "full"
Requires-Dist: tqdm (>=4.66.4,<5.0.0)
Requires-Dist: typing-extensions (>=4.6.3,<5.0.0)
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tuneinsight"
version = "1.1.3" # Ignored.
version = "1.1.4" # Ignored.
description = "Official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API."
authors = ["Tune Insight SA"]
license = "Apache-2.0"
Expand Down Expand Up @@ -36,9 +36,10 @@ black = "24.2.0"
httpx = ">=0.15.4,<0.28.0"
attrs = ">=21.3.0"
certifi = "^2024.07.04"
jinja2 = "^3.1.6"

# Minimal versions required to fix known vulnerabilities in imports.
requests = ">= 2.32.4"
jinja2 = "^3.1.6"
h11 = "^0.16.0"
cryptography = "^44.0.1"

Expand Down
2 changes: 1 addition & 1 deletion src/tuneinsight/api/api-checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e36e6c50fbaa6cc741561a596e346284fb9a161b523f0bdfacc4013a389e0d62
491ea8ae3c034227264004fadf4d8bb0191b8df930e5a8ddd8d1a22992ba195b
2 changes: 1 addition & 1 deletion src/tuneinsight/api/sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" A client library for accessing Tune Insight API """
"""A client library for accessing Tune Insight API"""

from .client import AuthenticatedClient, Client

Expand Down
2 changes: 1 addition & 1 deletion src/tuneinsight/api/sdk/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Contains methods for accessing the API """
"""Contains methods for accessing the API"""
202 changes: 202 additions & 0 deletions src/tuneinsight/api/sdk/api/api_computations/patch_computation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

from ... import errors
from ...client import Client
from ...models.computation import Computation
from ...models.error import Error
from ...types import UNSET, Response, Unset


def _get_kwargs(
computation_id: str,
*,
client: Client,
notify_end: Union[Unset, None, bool] = UNSET,
) -> Dict[str, Any]:
url = "{}/computation/{computationId}".format(client.base_url, computationId=computation_id)

headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

params: Dict[str, Any] = {}
params["notifyEnd"] = notify_end

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https://")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http://")
if http_proxy:
proxies = http_proxy

return {
"method": "patch",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
"params": params,
}


def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Computation, Error]]:
if response.status_code == HTTPStatus.OK:
response_200 = Computation.from_dict(response.json())

return response_200
if response.status_code == HTTPStatus.FORBIDDEN:
response_403 = Error.from_dict(response.json())

return response_403
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = Error.from_dict(response.json())

return response_404
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
response_500 = Error.from_dict(response.json())

return response_500
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code} ({response})")
else:
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Computation, Error]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
computation_id: str,
*,
client: Client,
notify_end: Union[Unset, None, bool] = UNSET,
) -> Response[Union[Computation, Error]]:
"""Modify editable attributes from a computation.

Args:
computation_id (str):
notify_end (Union[Unset, None, bool]):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Computation, Error]]
"""

kwargs = _get_kwargs(
computation_id=computation_id,
client=client,
notify_end=notify_end,
)

response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
computation_id: str,
*,
client: Client,
notify_end: Union[Unset, None, bool] = UNSET,
) -> Optional[Union[Computation, Error]]:
"""Modify editable attributes from a computation.

Args:
computation_id (str):
notify_end (Union[Unset, None, bool]):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Computation, Error]]
"""

return sync_detailed(
computation_id=computation_id,
client=client,
notify_end=notify_end,
).parsed


async def asyncio_detailed(
computation_id: str,
*,
client: Client,
notify_end: Union[Unset, None, bool] = UNSET,
) -> Response[Union[Computation, Error]]:
"""Modify editable attributes from a computation.

Args:
computation_id (str):
notify_end (Union[Unset, None, bool]):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Computation, Error]]
"""

kwargs = _get_kwargs(
computation_id=computation_id,
client=client,
notify_end=notify_end,
)

async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
computation_id: str,
*,
client: Client,
notify_end: Union[Unset, None, bool] = UNSET,
) -> Optional[Union[Computation, Error]]:
"""Modify editable attributes from a computation.

Args:
computation_id (str):
notify_end (Union[Unset, None, bool]):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Computation, Error]]
"""

return (
await asyncio_detailed(
computation_id=computation_id,
client=client,
notify_end=notify_end,
)
).parsed
Loading