Skip to content

Commit 8f91e55

Browse files
chore(internal): options updates (#67)
1 parent a2bfc1c commit 8f91e55

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/orb/_base_client.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def _request(
863863
self._prepare_request(request)
864864

865865
try:
866-
response = self._client.send(request, auth=self.custom_auth, stream=stream)
866+
response = self._client.send(request, auth=self.custom_auth, stream=stream or options.stream or False)
867867
log.debug(
868868
'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase
869869
)
@@ -1304,7 +1304,7 @@ async def _request(
13041304
await self._prepare_request(request)
13051305

13061306
try:
1307-
response = await self._client.send(request, auth=self.custom_auth, stream=stream)
1307+
response = await self._client.send(request, auth=self.custom_auth, stream=stream or options.stream or False)
13081308
log.debug(
13091309
'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase
13101310
)
@@ -1541,6 +1541,7 @@ def make_request_options(
15411541
idempotency_key: str | None = None,
15421542
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
15431543
post_parser: PostParser | NotGiven = NOT_GIVEN,
1544+
stream: bool | None = None,
15441545
) -> RequestOptions:
15451546
"""Create a dict of type RequestOptions without keys of NotGiven values."""
15461547
options: RequestOptions = {}
@@ -1562,6 +1563,9 @@ def make_request_options(
15621563
if idempotency_key is not None:
15631564
options["idempotency_key"] = idempotency_key
15641565

1566+
if stream is not None:
1567+
options["stream"] = stream
1568+
15651569
if is_given(post_parser):
15661570
# internal
15671571
options["post_parser"] = post_parser # type: ignore

src/orb/_models.py

+2
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
403403
params: Query
404404
headers: Headers
405405
max_retries: int
406+
stream: bool | None
406407
timeout: float | Timeout | None
407408
files: HttpxRequestFiles | None
408409
idempotency_key: str
@@ -420,6 +421,7 @@ class FinalRequestOptions(pydantic.BaseModel):
420421
timeout: Union[float, Timeout, None, NotGiven] = NotGiven()
421422
files: Union[HttpxRequestFiles, None] = None
422423
idempotency_key: Union[str, None] = None
424+
stream: Union[bool, None] = None
423425
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
424426

425427
# It should be noted that we cannot use `json` here as that would override

src/orb/_types.py

+1
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ async def aclose(self) -> None:
257257
class RequestOptions(TypedDict, total=False):
258258
headers: Headers
259259
max_retries: int
260+
stream: bool
260261
timeout: float | Timeout | None
261262
params: Query
262263
extra_json: AnyMapping

0 commit comments

Comments
 (0)