Skip to content

Commit 1b6d908

Browse files
stainless-botRobertCraigie
authored andcommitted
feat(client): support passing httpx.URL instances to base_url
1 parent 120f2b1 commit 1b6d908

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/openai/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898
organization: str | None = _os.environ.get("OPENAI_ORG_ID")
9999

100-
base_url: str | None = None
100+
base_url: str | _httpx.URL | None = None
101101

102102
timeout: float | Timeout | None = DEFAULT_TIMEOUT
103103

src/openai/_base_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def __init__(
331331
self,
332332
*,
333333
version: str,
334-
base_url: str,
334+
base_url: str | URL,
335335
_strict_response_validation: bool,
336336
max_retries: int = DEFAULT_MAX_RETRIES,
337337
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
@@ -739,7 +739,7 @@ def __init__(
739739
self,
740740
*,
741741
version: str,
742-
base_url: str,
742+
base_url: str | URL,
743743
max_retries: int = DEFAULT_MAX_RETRIES,
744744
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
745745
transport: Transport | None = None,
@@ -1145,7 +1145,7 @@ def __init__(
11451145
self,
11461146
*,
11471147
version: str,
1148-
base_url: str,
1148+
base_url: str | URL,
11491149
_strict_response_validation: bool,
11501150
max_retries: int = DEFAULT_MAX_RETRIES,
11511151
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,

src/openai/_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import os
66
import asyncio
7-
from typing import Union, Mapping, Optional
7+
from typing import Union, Mapping
88

99
import httpx
1010

@@ -61,7 +61,7 @@ def __init__(
6161
*,
6262
api_key: str | None = None,
6363
organization: str | None = None,
64-
base_url: Optional[str] = None,
64+
base_url: str | httpx.URL | None = None,
6565
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
6666
max_retries: int = DEFAULT_MAX_RETRIES,
6767
default_headers: Mapping[str, str] | None = None,
@@ -146,7 +146,7 @@ def copy(
146146
*,
147147
api_key: str | None = None,
148148
organization: str | None = None,
149-
base_url: str | None = None,
149+
base_url: str | httpx.URL | None = None,
150150
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
151151
http_client: httpx.Client | None = None,
152152
max_retries: int | NotGiven = NOT_GIVEN,
@@ -260,7 +260,7 @@ def __init__(
260260
*,
261261
api_key: str | None = None,
262262
organization: str | None = None,
263-
base_url: Optional[str] = None,
263+
base_url: str | httpx.URL | None = None,
264264
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
265265
max_retries: int = DEFAULT_MAX_RETRIES,
266266
default_headers: Mapping[str, str] | None = None,
@@ -345,7 +345,7 @@ def copy(
345345
*,
346346
api_key: str | None = None,
347347
organization: str | None = None,
348-
base_url: str | None = None,
348+
base_url: str | httpx.URL | None = None,
349349
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
350350
http_client: httpx.AsyncClient | None = None,
351351
max_retries: int | NotGiven = NOT_GIVEN,

0 commit comments

Comments
 (0)