Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.0"
".": "0.7.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 25
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-efa19cc3cc7e8d1692f1952185eb882fd6250d5bc81af147aab3830fc39b4f8d.yml
openapi_spec_hash: 85a6c998ec4fbd8d526ccd3dd40bdf96
config_hash: 42515bf83f1e0e765071038fcf702122
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-c74e7376ab152155b24a3f8f21fa43709cbc94b6e8b33a6ed48a23a62f976d1a.yml
openapi_spec_hash: f430c7e1c4f367245df8145df75fb443
config_hash: e88d2c04584e96ef1e76c72156c3c186
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.7.0 (2025-07-12)

Full Changelog: [v0.6.0...v0.7.0](https://github.com/steel-dev/steel-python/compare/v0.6.0...v0.7.0)

### Features

* **api:** api update ([7c3a807](https://github.com/steel-dev/steel-python/commit/7c3a8071ad39d7d371c68bc5632630aba52d1126))


### Bug Fixes

* **client:** don't send Content-Type header on GET requests ([3663409](https://github.com/steel-dev/steel-python/commit/366340962d2ad7252fc25b70399293cb2b8687aa))
* **parsing:** correctly handle nested discriminated unions ([d88c056](https://github.com/steel-dev/steel-python/commit/d88c05684f94be0249181c40365ae1605e65c9d8))


### Chores

* **internal:** bump pinned h11 dep ([f79c166](https://github.com/steel-dev/steel-python/commit/f79c16621c3a9e5b902f28294a82638f7165cf49))
* **package:** mark python 3.13 as supported ([a70bc61](https://github.com/steel-dev/steel-python/commit/a70bc614385d48955991218901b9ae8b0ca2ae1e))
* **readme:** fix version rendering on pypi ([14b7820](https://github.com/steel-dev/steel-python/commit/14b7820aff48a061d6eeb74df86ec2e896d5e25c))

## 0.6.0 (2025-07-02)

Full Changelog: [v0.5.0...v0.6.0](https://github.com/steel-dev/steel-python/compare/v0.5.0...v0.6.0)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Steel Python API library

[![PyPI version](<https://img.shields.io/pypi/v/steel-sdk.svg?label=pypi%20(stable)>)](https://pypi.org/project/steel-sdk/)
<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/steel-sdk.svg?label=pypi%20(stable))](https://pypi.org/project/steel-sdk/)

The Steel Python library provides convenient access to the Steel REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down
13 changes: 13 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,16 @@ Methods:
- <code title="get /v1/sessions/{sessionId}/files/{path}">client.sessions.files.<a href="./src/steel/resources/sessions/files.py">download</a>(path, \*, session_id) -> BinaryAPIResponse</code>
- <code title="get /v1/sessions/{sessionId}/files.zip">client.sessions.files.<a href="./src/steel/resources/sessions/files.py">download_archive</a>(session_id) -> BinaryAPIResponse</code>
- <code title="post /v1/sessions/{sessionId}/files">client.sessions.files.<a href="./src/steel/resources/sessions/files.py">upload</a>(session_id, \*\*<a href="src/steel/types/sessions/file_upload_params.py">params</a>) -> <a href="./src/steel/types/file.py">File</a></code>

## Captchas

Types:

```python
from steel.types.sessions import CaptchaSolveImageResponse, CaptchaStatusResponse
```

Methods:

- <code title="post /v1/sessions/{sessionId}/captchas/solve-image">client.sessions.captchas.<a href="./src/steel/resources/sessions/captchas.py">solve_image</a>(session_id, \*\*<a href="src/steel/types/sessions/captcha_solve_image_params.py">params</a>) -> <a href="./src/steel/types/sessions/captcha_solve_image_response.py">CaptchaSolveImageResponse</a></code>
- <code title="get /v1/sessions/{sessionId}/captchas/status">client.sessions.captchas.<a href="./src/steel/resources/sessions/captchas.py">status</a>(session_id) -> <a href="./src/steel/types/sessions/captcha_status_response.py">CaptchaStatusResponse</a></code>
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "steel-sdk"
version = "0.6.0"
version = "0.7.0"
description = "The official Python library for the steel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
Expand All @@ -38,7 +39,7 @@ Homepage = "https://github.com/steel-dev/steel-python"
Repository = "https://github.com/steel-dev/steel-python"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]

[tool.rye]
managed = true
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ filelock==3.12.4
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via respx
# via steel-sdk
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via steel-sdk
idna==3.4
# via anyio
Expand Down
6 changes: 3 additions & 3 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ exceptiongroup==1.2.2
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via steel-sdk
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via steel-sdk
idna==3.4
# via anyio
Expand Down
11 changes: 9 additions & 2 deletions src/steel/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ def _build_request(
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}

is_body_allowed = options.method.lower() != "get"

if is_body_allowed:
kwargs["json"] = json_data if is_given(json_data) else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)
kwargs.pop("data", None)

# TODO: report this error to httpx
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
headers=headers,
Expand All @@ -540,8 +549,6 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)

Expand Down
13 changes: 8 additions & 5 deletions src/steel/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import os
import inspect
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
from datetime import date, datetime
from typing_extensions import (
List,
Unpack,
Literal,
ClassVar,
Expand Down Expand Up @@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if type_ is None:
raise RuntimeError(f"Unexpected field type is None for {key}")

return construct_type(value=value, type_=type_)
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))


def is_basemodel(type_: type) -> bool:
Expand Down Expand Up @@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
return cast(_T, construct_type(value=value, type_=type_))


def construct_type(*, value: object, type_: object) -> object:
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
"""Loose coercion to the expected type with construction of nested values.

If the given value does not match the expected type then it is returned as-is.
Expand All @@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object:
type_ = type_.__value__ # type: ignore[unreachable]

# unwrap `Annotated[T, ...]` -> `T`
if is_annotated_type(type_):
meta: tuple[Any, ...] = get_args(type_)[1:]
if metadata is not None:
meta: tuple[Any, ...] = tuple(metadata)
elif is_annotated_type(type_):
meta = get_args(type_)[1:]
type_ = extract_type_arg(type_, 0)
else:
meta = tuple()
Expand Down
2 changes: 1 addition & 1 deletion src/steel/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "steel"
__version__ = "0.6.0" # x-release-please-version
__version__ = "0.7.0" # x-release-please-version
14 changes: 14 additions & 0 deletions src/steel/resources/sessions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
FilesResourceWithStreamingResponse,
AsyncFilesResourceWithStreamingResponse,
)
from .captchas import (
CaptchasResource,
AsyncCaptchasResource,
CaptchasResourceWithRawResponse,
AsyncCaptchasResourceWithRawResponse,
CaptchasResourceWithStreamingResponse,
AsyncCaptchasResourceWithStreamingResponse,
)
from .sessions import (
SessionsResource,
AsyncSessionsResource,
Expand All @@ -24,6 +32,12 @@
"AsyncFilesResourceWithRawResponse",
"FilesResourceWithStreamingResponse",
"AsyncFilesResourceWithStreamingResponse",
"CaptchasResource",
"AsyncCaptchasResource",
"CaptchasResourceWithRawResponse",
"AsyncCaptchasResourceWithRawResponse",
"CaptchasResourceWithStreamingResponse",
"AsyncCaptchasResourceWithStreamingResponse",
"SessionsResource",
"AsyncSessionsResource",
"SessionsResourceWithRawResponse",
Expand Down
Loading