only ignore skyvern/artifacts folder (#2449)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -160,7 +160,7 @@ ig_*
|
||||
|
||||
# Skyvern ignores
|
||||
videos/
|
||||
artifacts/
|
||||
skyvern/artifacts/
|
||||
traces/
|
||||
*.pkl
|
||||
har/
|
||||
|
||||
2
skyvern/client/artifacts/__init__.py
Normal file
2
skyvern/client/artifacts/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
165
skyvern/client/artifacts/client.py
Normal file
165
skyvern/client/artifacts/client.py
Normal file
@@ -0,0 +1,165 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
from ..core.client_wrapper import SyncClientWrapper
|
||||
import typing
|
||||
from ..core.request_options import RequestOptions
|
||||
from ..types.artifact import Artifact
|
||||
from ..core.jsonable_encoder import jsonable_encoder
|
||||
from ..core.pydantic_utilities import parse_obj_as
|
||||
from ..errors.not_found_error import NotFoundError
|
||||
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
||||
from json.decoder import JSONDecodeError
|
||||
from ..core.api_error import ApiError
|
||||
from ..core.client_wrapper import AsyncClientWrapper
|
||||
|
||||
|
||||
class ArtifactsClient:
|
||||
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
||||
self._client_wrapper = client_wrapper
|
||||
|
||||
def get_artifact(self, artifact_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Artifact:
|
||||
"""
|
||||
Get an artifact
|
||||
|
||||
Parameters
|
||||
----------
|
||||
artifact_id : str
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Artifact
|
||||
Successfully retrieved artifact
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.artifacts.get_artifact(
|
||||
artifact_id="artifact_id",
|
||||
)
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/artifacts/{jsonable_encoder(artifact_id)}",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Artifact,
|
||||
parse_obj_as(
|
||||
type_=Artifact, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_response_json = _response.json()
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
|
||||
class AsyncArtifactsClient:
|
||||
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
||||
self._client_wrapper = client_wrapper
|
||||
|
||||
async def get_artifact(
|
||||
self, artifact_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> Artifact:
|
||||
"""
|
||||
Get an artifact
|
||||
|
||||
Parameters
|
||||
----------
|
||||
artifact_id : str
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Artifact
|
||||
Successfully retrieved artifact
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.artifacts.get_artifact(
|
||||
artifact_id="artifact_id",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/artifacts/{jsonable_encoder(artifact_id)}",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Artifact,
|
||||
parse_obj_as(
|
||||
type_=Artifact, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_response_json = _response.json()
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
Reference in New Issue
Block a user