feat: add SKYVERN_BASE_URL environment variable support for client configuration
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
# This file was auto-generated by Fern from our API Definition.
|
# This file was auto-generated by Fern from our API Definition.
|
||||||
|
|
||||||
|
import os
|
||||||
import typing
|
import typing
|
||||||
|
import logging
|
||||||
from .environment import SkyvernEnvironment
|
from .environment import SkyvernEnvironment
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
from .core.client_wrapper import SyncClientWrapper
|
from .core.client_wrapper import SyncClientWrapper
|
||||||
from .types.run_engine import RunEngine
|
from .types.run_engine import RunEngine
|
||||||
from .types.proxy_location import ProxyLocation
|
from .types.proxy_location import ProxyLocation
|
||||||
@@ -42,7 +46,9 @@ class Skyvern:
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
base_url : typing.Optional[str]
|
base_url : typing.Optional[str]
|
||||||
The base url to use for requests from the client.
|
The base url to use for requests from the client. If omitted, the value
|
||||||
|
of the ``SKYVERN_BASE_URL`` environment variable is used when set; otherwise
|
||||||
|
it falls back to the selected ``environment``.
|
||||||
|
|
||||||
environment : SkyvernEnvironment
|
environment : SkyvernEnvironment
|
||||||
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
||||||
@@ -1622,7 +1628,9 @@ class AsyncSkyvern:
|
|||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
base_url : typing.Optional[str]
|
base_url : typing.Optional[str]
|
||||||
The base url to use for requests from the client.
|
The base url to use for requests from the client. If omitted, the value
|
||||||
|
of the ``SKYVERN_BASE_URL`` environment variable is used when set; otherwise
|
||||||
|
it falls back to the selected ``environment``.
|
||||||
|
|
||||||
environment : SkyvernEnvironment
|
environment : SkyvernEnvironment
|
||||||
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
The environment to use for requests from the client. from .environment import SkyvernEnvironment
|
||||||
@@ -3353,8 +3361,16 @@ class AsyncSkyvern:
|
|||||||
|
|
||||||
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyvernEnvironment) -> str:
|
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: SkyvernEnvironment) -> str:
|
||||||
if base_url is not None:
|
if base_url is not None:
|
||||||
|
logger.debug("Using explicit base_url: %s", base_url)
|
||||||
return base_url
|
return base_url
|
||||||
elif environment is not None:
|
|
||||||
|
env_base_url = os.getenv("SKYVERN_BASE_URL")
|
||||||
|
if env_base_url:
|
||||||
|
logger.debug("Using SKYVERN_BASE_URL from environment: %s", env_base_url)
|
||||||
|
return env_base_url
|
||||||
|
|
||||||
|
if environment is not None:
|
||||||
|
logger.debug("Using base_url from environment enum: %s", environment.value)
|
||||||
return environment.value
|
return environment.value
|
||||||
else:
|
|
||||||
raise Exception("Please pass in either base_url or environment to construct the client")
|
raise Exception("Please pass in either base_url or environment to construct the client")
|
||||||
|
|||||||
Reference in New Issue
Block a user