Skip to content

Commit 5981a58

Browse files
feat(api): api update
1 parent 871a8c7 commit 5981a58

5 files changed

Lines changed: 30 additions & 7 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 105
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-deba6a4c5b1912e4d2d8c2875077776baf7fed7b06c0adc2ba7454c7ccb5f34c.yml
3-
openapi_spec_hash: 069f40ac62acc6ba93c801abf088df5b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-330fb5793f8e35033c1f808e50edb169d04f041d1d03a29f82a88c41277d0d08.yml
3+
openapi_spec_hash: f3c6dc87348c94d873eafb1bf4f10bc1
44
config_hash: acdf4142177ed1932c2d82372693f811

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ $ pip install ./path-to-wheel-file.whl
8888
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
8989

9090
```sh
91-
# you will need npm installed
92-
$ npx prism mock path/to/your/openapi.yml
91+
$ ./scripts/mock
9392
```
9493

9594
```sh

‎src/asktable/_response.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
152152
),
153153
response=self.http_response,
154154
client=cast(Any, self._client),
155+
options=self._options,
155156
),
156157
)
157158

@@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
162163
cast_to=extract_stream_chunk_type(self._stream_cls),
163164
response=self.http_response,
164165
client=cast(Any, self._client),
166+
options=self._options,
165167
),
166168
)
167169

@@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
175177
cast_to=cast_to,
176178
response=self.http_response,
177179
client=cast(Any, self._client),
180+
options=self._options,
178181
),
179182
)
180183

‎src/asktable/_streaming.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55
import inspect
66
from types import TracebackType
7-
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast
7+
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
88
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable
99

1010
import httpx
@@ -13,6 +13,7 @@
1313

1414
if TYPE_CHECKING:
1515
from ._client import Asktable, AsyncAsktable
16+
from ._models import FinalRequestOptions
1617

1718

1819
_T = TypeVar("_T")
@@ -22,7 +23,7 @@ class Stream(Generic[_T]):
2223
"""Provides the core interface to iterate over a synchronous stream response."""
2324

2425
response: httpx.Response
25-
26+
_options: Optional[FinalRequestOptions] = None
2627
_decoder: SSEBytesDecoder
2728

2829
def __init__(
@@ -31,10 +32,12 @@ def __init__(
3132
cast_to: type[_T],
3233
response: httpx.Response,
3334
client: Asktable,
35+
options: Optional[FinalRequestOptions] = None,
3436
) -> None:
3537
self.response = response
3638
self._cast_to = cast_to
3739
self._client = client
40+
self._options = options
3841
self._decoder = client._make_sse_decoder()
3942
self._iterator = self.__stream__()
4043

@@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]):
8588
"""Provides the core interface to iterate over an asynchronous stream response."""
8689

8790
response: httpx.Response
88-
91+
_options: Optional[FinalRequestOptions] = None
8992
_decoder: SSEDecoder | SSEBytesDecoder
9093

9194
def __init__(
@@ -94,10 +97,12 @@ def __init__(
9497
cast_to: type[_T],
9598
response: httpx.Response,
9699
client: AsyncAsktable,
100+
options: Optional[FinalRequestOptions] = None,
97101
) -> None:
98102
self.response = response
99103
self._cast_to = cast_to
100104
self._client = client
105+
self._options = options
101106
self._decoder = client._make_sse_decoder()
102107
self._iterator = self.__stream__()
103108

‎tests/test_client.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
941941
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
942942
# Test that the proxy environment variables are set correctly
943943
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
944+
# Delete in case our environment has any proxy env vars set
945+
monkeypatch.delenv("HTTP_PROXY", raising=False)
946+
monkeypatch.delenv("ALL_PROXY", raising=False)
947+
monkeypatch.delenv("NO_PROXY", raising=False)
948+
monkeypatch.delenv("http_proxy", raising=False)
949+
monkeypatch.delenv("https_proxy", raising=False)
950+
monkeypatch.delenv("all_proxy", raising=False)
951+
monkeypatch.delenv("no_proxy", raising=False)
944952

945953
client = DefaultHttpxClient()
946954

@@ -1841,6 +1849,14 @@ async def test_get_platform(self) -> None:
18411849
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18421850
# Test that the proxy environment variables are set correctly
18431851
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1852+
# Delete in case our environment has any proxy env vars set
1853+
monkeypatch.delenv("HTTP_PROXY", raising=False)
1854+
monkeypatch.delenv("ALL_PROXY", raising=False)
1855+
monkeypatch.delenv("NO_PROXY", raising=False)
1856+
monkeypatch.delenv("http_proxy", raising=False)
1857+
monkeypatch.delenv("https_proxy", raising=False)
1858+
monkeypatch.delenv("all_proxy", raising=False)
1859+
monkeypatch.delenv("no_proxy", raising=False)
18441860

18451861
client = DefaultAsyncHttpxClient()
18461862

0 commit comments

Comments
 (0)