v1.0.19: make env vars should always overrides api keys stored in the streamlit mount in skyvern image (#4824)
This commit is contained in:
@@ -53,6 +53,7 @@ if typing.TYPE_CHECKING:
|
||||
BrowserSessionResponse,
|
||||
ChangeTierResponse,
|
||||
CheckoutSessionResponse,
|
||||
ClearCacheResponse,
|
||||
ClickAction,
|
||||
ClickActionData,
|
||||
ClickContext,
|
||||
@@ -581,6 +582,7 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"BrowserSessionResponse": ".types",
|
||||
"ChangeTierResponse": ".types",
|
||||
"CheckoutSessionResponse": ".types",
|
||||
"ClearCacheResponse": ".types",
|
||||
"ClickAction": ".types",
|
||||
"ClickActionData": ".types",
|
||||
"ClickContext": ".types",
|
||||
@@ -1135,6 +1137,7 @@ __all__ = [
|
||||
"BrowserSessionResponse",
|
||||
"ChangeTierResponse",
|
||||
"CheckoutSessionResponse",
|
||||
"ClearCacheResponse",
|
||||
"ClickAction",
|
||||
"ClickActionData",
|
||||
"ClickContext",
|
||||
|
||||
@@ -18,6 +18,7 @@ from .types.browser_profile import BrowserProfile
|
||||
from .types.browser_session_response import BrowserSessionResponse
|
||||
from .types.change_tier_response import ChangeTierResponse
|
||||
from .types.checkout_session_response import CheckoutSessionResponse
|
||||
from .types.clear_cache_response import ClearCacheResponse
|
||||
from .types.create_credential_request_credential import CreateCredentialRequestCredential
|
||||
from .types.create_script_response import CreateScriptResponse
|
||||
from .types.credential_response import CredentialResponse
|
||||
@@ -2101,6 +2102,39 @@ class Skyvern:
|
||||
_response = self._raw_client.deploy_script(script_id, files=files, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
def clear_workflow_cache(
|
||||
self, workflow_permanent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> ClearCacheResponse:
|
||||
"""
|
||||
Clear all cached scripts for a specific workflow. This will trigger script regeneration on subsequent runs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
The workflow permanent ID to clear cache for
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
ClearCacheResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.clear_workflow_cache(
|
||||
workflow_permanent_id="wpid_abc123",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.clear_workflow_cache(workflow_permanent_id, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
def run_sdk_action(
|
||||
self,
|
||||
*,
|
||||
@@ -4647,6 +4681,47 @@ class AsyncSkyvern:
|
||||
_response = await self._raw_client.deploy_script(script_id, files=files, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
async def clear_workflow_cache(
|
||||
self, workflow_permanent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> ClearCacheResponse:
|
||||
"""
|
||||
Clear all cached scripts for a specific workflow. This will trigger script regeneration on subsequent runs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
The workflow permanent ID to clear cache for
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
ClearCacheResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.clear_workflow_cache(
|
||||
workflow_permanent_id="wpid_abc123",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.clear_workflow_cache(workflow_permanent_id, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
async def run_sdk_action(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -22,10 +22,10 @@ class BaseClientWrapper:
|
||||
|
||||
def get_headers(self) -> typing.Dict[str, str]:
|
||||
headers: typing.Dict[str, str] = {
|
||||
"User-Agent": "skyvern/1.0.18",
|
||||
"User-Agent": "skyvern/1.0.19",
|
||||
"X-Fern-Language": "Python",
|
||||
"X-Fern-SDK-Name": "skyvern",
|
||||
"X-Fern-SDK-Version": "1.0.18",
|
||||
"X-Fern-SDK-Version": "1.0.19",
|
||||
**(self.get_custom_headers() or {}),
|
||||
}
|
||||
if self._api_key is not None:
|
||||
|
||||
@@ -24,6 +24,7 @@ from .types.browser_profile import BrowserProfile
|
||||
from .types.browser_session_response import BrowserSessionResponse
|
||||
from .types.change_tier_response import ChangeTierResponse
|
||||
from .types.checkout_session_response import CheckoutSessionResponse
|
||||
from .types.clear_cache_response import ClearCacheResponse
|
||||
from .types.create_credential_request_credential import CreateCredentialRequestCredential
|
||||
from .types.create_script_response import CreateScriptResponse
|
||||
from .types.credential_response import CredentialResponse
|
||||
@@ -2884,6 +2885,56 @@ class RawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
def clear_workflow_cache(
|
||||
self, workflow_permanent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> HttpResponse[ClearCacheResponse]:
|
||||
"""
|
||||
Clear all cached scripts for a specific workflow. This will trigger script regeneration on subsequent runs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
The workflow permanent ID to clear cache for
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[ClearCacheResponse]
|
||||
Successful Response
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/scripts/{jsonable_encoder(workflow_permanent_id)}/cache",
|
||||
method="DELETE",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
ClearCacheResponse,
|
||||
parse_obj_as(
|
||||
type_=ClearCacheResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return HttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
headers=dict(_response.headers),
|
||||
body=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, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
def run_sdk_action(
|
||||
self,
|
||||
*,
|
||||
@@ -6013,6 +6064,56 @@ class AsyncRawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
async def clear_workflow_cache(
|
||||
self, workflow_permanent_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> AsyncHttpResponse[ClearCacheResponse]:
|
||||
"""
|
||||
Clear all cached scripts for a specific workflow. This will trigger script regeneration on subsequent runs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
The workflow permanent ID to clear cache for
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[ClearCacheResponse]
|
||||
Successful Response
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/scripts/{jsonable_encoder(workflow_permanent_id)}/cache",
|
||||
method="DELETE",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
ClearCacheResponse,
|
||||
parse_obj_as(
|
||||
type_=ClearCacheResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return AsyncHttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
headers=dict(_response.headers),
|
||||
body=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, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
async def run_sdk_action(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -56,6 +56,7 @@ if typing.TYPE_CHECKING:
|
||||
from .browser_session_response import BrowserSessionResponse
|
||||
from .change_tier_response import ChangeTierResponse
|
||||
from .checkout_session_response import CheckoutSessionResponse
|
||||
from .clear_cache_response import ClearCacheResponse
|
||||
from .click_action import ClickAction
|
||||
from .click_action_data import ClickActionData
|
||||
from .click_context import ClickContext
|
||||
@@ -622,6 +623,7 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"BrowserSessionResponse": ".browser_session_response",
|
||||
"ChangeTierResponse": ".change_tier_response",
|
||||
"CheckoutSessionResponse": ".checkout_session_response",
|
||||
"ClearCacheResponse": ".clear_cache_response",
|
||||
"ClickAction": ".click_action",
|
||||
"ClickActionData": ".click_action_data",
|
||||
"ClickContext": ".click_context",
|
||||
@@ -1166,6 +1168,7 @@ __all__ = [
|
||||
"BrowserSessionResponse",
|
||||
"ChangeTierResponse",
|
||||
"CheckoutSessionResponse",
|
||||
"ClearCacheResponse",
|
||||
"ClickAction",
|
||||
"ClickActionData",
|
||||
"ClickContext",
|
||||
|
||||
31
skyvern/client/types/clear_cache_response.py
Normal file
31
skyvern/client/types/clear_cache_response.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import typing
|
||||
|
||||
import pydantic
|
||||
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
||||
|
||||
|
||||
class ClearCacheResponse(UniversalBaseModel):
|
||||
"""
|
||||
Response model for cache clearing operations.
|
||||
"""
|
||||
|
||||
deleted_count: int = pydantic.Field()
|
||||
"""
|
||||
Number of cached entries deleted
|
||||
"""
|
||||
|
||||
message: str = pydantic.Field()
|
||||
"""
|
||||
Status message
|
||||
"""
|
||||
|
||||
if IS_PYDANTIC_V2:
|
||||
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
||||
else:
|
||||
|
||||
class Config:
|
||||
frozen = True
|
||||
smart_union = True
|
||||
extra = pydantic.Extra.allow
|
||||
@@ -33,6 +33,16 @@ class CredentialResponse(UniversalBaseModel):
|
||||
Name of the credential
|
||||
"""
|
||||
|
||||
browser_profile_id: typing.Optional[str] = pydantic.Field(default=None)
|
||||
"""
|
||||
Browser profile ID linked to this credential
|
||||
"""
|
||||
|
||||
tested_url: typing.Optional[str] = pydantic.Field(default=None)
|
||||
"""
|
||||
Login page URL used during the credential test
|
||||
"""
|
||||
|
||||
if IS_PYDANTIC_V2:
|
||||
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
||||
else:
|
||||
|
||||
@@ -37,6 +37,9 @@ class WorkflowRun(UniversalBaseModel):
|
||||
sequential_key: typing.Optional[str] = None
|
||||
ai_fallback: typing.Optional[bool] = None
|
||||
code_gen: typing.Optional[bool] = None
|
||||
waiting_for_verification_code: typing.Optional[bool] = None
|
||||
verification_code_identifier: typing.Optional[str] = None
|
||||
verification_code_polling_started_at: typing.Optional[dt.datetime] = None
|
||||
queued_at: typing.Optional[dt.datetime] = None
|
||||
started_at: typing.Optional[dt.datetime] = None
|
||||
finished_at: typing.Optional[dt.datetime] = None
|
||||
|
||||
Reference in New Issue
Block a user