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.2.0"
".": "0.3.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-c8306e25d5c8e0d16318b9d44a683dd3d10f8d8b3d56ecbd1952d7f9e95d7f08.yml
openapi_spec_hash: 9877212f13f31009e05d8a1f8b2dd750
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-df307c8d4d17c23d37054bf05f4d0a154be8011730c73ef8b3cfc987bcbdc05e.yml
openapi_spec_hash: f3227dde2385091c20c58a17621286c7
config_hash: f23d5011c9a89d67725b48e96ffb7c99
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.3.0 (2025-05-12)

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

### Features

* **api:** api update ([de03f2d](https://github.com/steel-dev/steel-python/commit/de03f2d18de91dd52b45652466a6bc9c2772a00a))


### Bug Fixes

* **package:** support direct resource imports ([6bcebb1](https://github.com/steel-dev/steel-python/commit/6bcebb13d5af14d8e6415d0d0256b22431f78e76))


### Chores

* **internal:** avoid errors for isinstance checks on proxies ([5517961](https://github.com/steel-dev/steel-python/commit/5517961f8463167e35f6e0befea81caf4d4fbfd4))

## 0.2.0 (2025-04-24)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/steel-dev/steel-python/compare/v0.1.0...v0.2.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "steel-sdk"
version = "0.2.0"
version = "0.3.0"
description = "The official Python library for the steel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 5 additions & 0 deletions src/steel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import typing as _t

from . import types
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
Expand Down Expand Up @@ -68,6 +70,9 @@
"DefaultAsyncHttpxClient",
]

if not _t.TYPE_CHECKING:
from ._utils._resources_proxy import resources as resources

_setup_logging()

# Update the __module__ attribute for exported symbols so that
Expand Down
5 changes: 4 additions & 1 deletion src/steel/_utils/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
@property # type: ignore
@override
def __class__(self) -> type: # pyright: ignore
proxied = self.__get_proxied__()
try:
proxied = self.__get_proxied__()
except Exception:
return type(self)
if issubclass(type(proxied), LazyProxy):
return type(proxied)
return proxied.__class__
Expand Down
24 changes: 24 additions & 0 deletions src/steel/_utils/_resources_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import Any
from typing_extensions import override

from ._proxy import LazyProxy


class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `steel.resources` module.

This is used so that we can lazily import `steel.resources` only when
needed *and* so that users can just import `steel` and reference `steel.resources`
"""

@override
def __load__(self) -> Any:
import importlib

mod = importlib.import_module("steel.resources")
return mod


resources = ResourcesProxy().__as_proxied__()
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.2.0" # x-release-please-version
__version__ = "0.3.0" # x-release-please-version
71 changes: 66 additions & 5 deletions src/steel/types/session_context.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, List, Optional
from datetime import datetime
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from .._models import BaseModel

__all__ = ["SessionContext", "Cookie"]
__all__ = [
"SessionContext",
"Cookie",
"CookiePartitionKey",
"IndexedDB",
"IndexedDBData",
"IndexedDBDataRecord",
"IndexedDBDataRecordBlobFile",
]


class CookiePartitionKey(BaseModel):
has_cross_site_ancestor: bool = FieldInfo(alias="hasCrossSiteAncestor")
"""
Indicates if the cookie has any ancestors that are cross-site to the
topLevelSite.
"""

top_level_site: str = FieldInfo(alias="topLevelSite")
"""
The site of the top-level URL the browser was visiting at the start of the
request to the endpoint that set the cookie.
"""


class Cookie(BaseModel):
Expand All @@ -26,7 +49,7 @@ class Cookie(BaseModel):
http_only: Optional[bool] = FieldInfo(alias="httpOnly", default=None)
"""Whether the cookie is HTTP only"""

partition_key: Optional[str] = FieldInfo(alias="partitionKey", default=None)
partition_key: Optional[CookiePartitionKey] = FieldInfo(alias="partitionKey", default=None)
"""The partition key of the cookie"""

path: Optional[str] = None
Expand Down Expand Up @@ -60,15 +83,53 @@ class Cookie(BaseModel):
"""The URL of the cookie"""


class IndexedDBDataRecordBlobFile(BaseModel):
blob_number: float = FieldInfo(alias="blobNumber")

mime_type: str = FieldInfo(alias="mimeType")

size: float

filename: Optional[str] = None

last_modified: Optional[datetime] = FieldInfo(alias="lastModified", default=None)

path: Optional[str] = None


class IndexedDBDataRecord(BaseModel):
blob_files: Optional[List[IndexedDBDataRecordBlobFile]] = FieldInfo(alias="blobFiles", default=None)

key: Optional[object] = None

value: Optional[object] = None


class IndexedDBData(BaseModel):
id: float

name: str

records: List[IndexedDBDataRecord]


class IndexedDB(BaseModel):
id: float

data: List[IndexedDBData]

name: str


class SessionContext(BaseModel):
cookies: Optional[List[Cookie]] = None
"""Cookies to initialize in the session"""

indexed_db: Optional[Dict[str, List[Dict[str, object]]]] = FieldInfo(alias="indexedDB", default=None)
indexed_db: Optional[Dict[str, List[IndexedDB]]] = FieldInfo(alias="indexedDB", default=None)
"""Domain-specific indexedDB items to initialize in the session"""

local_storage: Optional[Dict[str, Dict[str, object]]] = FieldInfo(alias="localStorage", default=None)
local_storage: Optional[Dict[str, Dict[str, str]]] = FieldInfo(alias="localStorage", default=None)
"""Domain-specific localStorage items to initialize in the session"""

session_storage: Optional[Dict[str, Dict[str, object]]] = FieldInfo(alias="sessionStorage", default=None)
session_storage: Optional[Dict[str, Dict[str, str]]] = FieldInfo(alias="sessionStorage", default=None)
"""Domain-specific sessionStorage items to initialize in the session"""
75 changes: 69 additions & 6 deletions src/steel/types/session_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@

from __future__ import annotations

from typing import Dict, Iterable
from typing import Dict, Union, Iterable
from datetime import datetime
from typing_extensions import Literal, Required, Annotated, TypedDict

from .._utils import PropertyInfo

__all__ = ["SessionCreateParams", "Dimensions", "SessionContext", "SessionContextCookie"]
__all__ = [
"SessionCreateParams",
"Dimensions",
"SessionContext",
"SessionContextCookie",
"SessionContextCookiePartitionKey",
"SessionContextIndexedDB",
"SessionContextIndexedDBData",
"SessionContextIndexedDBDataRecord",
"SessionContextIndexedDBDataRecordBlobFile",
]


class SessionCreateParams(TypedDict, total=False):
Expand Down Expand Up @@ -66,6 +77,20 @@ class Dimensions(TypedDict, total=False):
"""Width of the session"""


class SessionContextCookiePartitionKey(TypedDict, total=False):
has_cross_site_ancestor: Required[Annotated[bool, PropertyInfo(alias="hasCrossSiteAncestor")]]
"""
Indicates if the cookie has any ancestors that are cross-site to the
topLevelSite.
"""

top_level_site: Required[Annotated[str, PropertyInfo(alias="topLevelSite")]]
"""
The site of the top-level URL the browser was visiting at the start of the
request to the endpoint that set the cookie.
"""


class SessionContextCookie(TypedDict, total=False):
name: Required[str]
"""The name of the cookie"""
Expand All @@ -82,7 +107,7 @@ class SessionContextCookie(TypedDict, total=False):
http_only: Annotated[bool, PropertyInfo(alias="httpOnly")]
"""Whether the cookie is HTTP only"""

partition_key: Annotated[str, PropertyInfo(alias="partitionKey")]
partition_key: Annotated[SessionContextCookiePartitionKey, PropertyInfo(alias="partitionKey")]
"""The partition key of the cookie"""

path: str
Expand Down Expand Up @@ -116,15 +141,53 @@ class SessionContextCookie(TypedDict, total=False):
"""The URL of the cookie"""


class SessionContextIndexedDBDataRecordBlobFile(TypedDict, total=False):
blob_number: Required[Annotated[float, PropertyInfo(alias="blobNumber")]]

mime_type: Required[Annotated[str, PropertyInfo(alias="mimeType")]]

size: Required[float]

filename: str

last_modified: Annotated[Union[str, datetime], PropertyInfo(alias="lastModified", format="iso8601")]

path: str


class SessionContextIndexedDBDataRecord(TypedDict, total=False):
blob_files: Annotated[Iterable[SessionContextIndexedDBDataRecordBlobFile], PropertyInfo(alias="blobFiles")]

key: object

value: object


class SessionContextIndexedDBData(TypedDict, total=False):
id: Required[float]

name: Required[str]

records: Required[Iterable[SessionContextIndexedDBDataRecord]]


class SessionContextIndexedDB(TypedDict, total=False):
id: Required[float]

data: Required[Iterable[SessionContextIndexedDBData]]

name: Required[str]


class SessionContext(TypedDict, total=False):
cookies: Iterable[SessionContextCookie]
"""Cookies to initialize in the session"""

indexed_db: Annotated[Dict[str, Iterable[Dict[str, object]]], PropertyInfo(alias="indexedDB")]
indexed_db: Annotated[Dict[str, Iterable[SessionContextIndexedDB]], PropertyInfo(alias="indexedDB")]
"""Domain-specific indexedDB items to initialize in the session"""

local_storage: Annotated[Dict[str, Dict[str, object]], PropertyInfo(alias="localStorage")]
local_storage: Annotated[Dict[str, Dict[str, str]], PropertyInfo(alias="localStorage")]
"""Domain-specific localStorage items to initialize in the session"""

session_storage: Annotated[Dict[str, Dict[str, object]], PropertyInfo(alias="sessionStorage")]
session_storage: Annotated[Dict[str, Dict[str, str]], PropertyInfo(alias="sessionStorage")]
"""Domain-specific sessionStorage items to initialize in the session"""
Loading