Skip to content

Commit

Permalink
Merge pull request #33 from clear-street/release-please--branches--ma…
Browse files Browse the repository at this point in the history
…in--changes--next

release: 0.1.0-alpha.8
  • Loading branch information
sonicxml authored Aug 30, 2024
2 parents 4fe4e7a + 23dcc60 commit 53eb20d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 6 deletions.
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.1.0-alpha.7"
".": "0.1.0-alpha.8"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.8 (2024-08-30)

Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/clear-street/studio-sdk-python/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)

### Features

* **api:** update via SDK Studio ([#32](https://github.com/clear-street/studio-sdk-python/issues/32)) ([5260d3e](https://github.com/clear-street/studio-sdk-python/commit/5260d3e7fe0eb4b9ff729024642bb610a1b3de0f))

## 0.1.0-alpha.7 (2024-08-30)

Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/clear-street/studio-sdk-python/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ pip install --pre clear-street-studio-sdk
The full API of this library can be found in [api.md](api.md).

```python
import os
from studio_sdk import StudioSDK

client = StudioSDK()
client = StudioSDK(
# This is the default and can be omitted
bearer_token=os.environ.get("STUDIO_SDK_BEARER_TOKEN"),
)

entity = client.entities.retrieve(
"<your_entity_id>",
Expand All @@ -44,10 +48,14 @@ so that your Bearer Token is not stored in source control.
Simply import `AsyncStudioSDK` instead of `StudioSDK` and use `await` with each API call:

```python
import os
import asyncio
from studio_sdk import AsyncStudioSDK

client = AsyncStudioSDK()
client = AsyncStudioSDK(
# This is the default and can be omitted
bearer_token=os.environ.get("STUDIO_SDK_BEARER_TOKEN"),
)


async def main() -> None:
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 = "clear-street-studio-sdk"
version = "0.1.0-alpha.7"
version = "0.1.0-alpha.8"
description = "The official Python library for the studio-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/studio_sdk/_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__ = "studio_sdk"
__version__ = "0.1.0-alpha.7" # x-release-please-version
__version__ = "0.1.0-alpha.8" # x-release-please-version
23 changes: 22 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
from pydantic import ValidationError

from studio_sdk import StudioSDK, AsyncStudioSDK, APIResponseValidationError
from studio_sdk._types import Omit
from studio_sdk._models import BaseModel, FinalRequestOptions
from studio_sdk._constants import RAW_RESPONSE_HEADER
from studio_sdk._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
from studio_sdk._exceptions import APIStatusError, StudioSDKError, APITimeoutError, APIResponseValidationError
from studio_sdk._base_client import (
DEFAULT_TIMEOUT,
HTTPX_DEFAULT_TIMEOUT,
Expand Down Expand Up @@ -334,6 +335,16 @@ def test_default_headers_option(self) -> None:
assert request.headers.get("x-foo") == "stainless"
assert request.headers.get("x-stainless-lang") == "my-overriding-header"

def test_validate_headers(self) -> None:
client = StudioSDK(base_url=base_url, bearer_token=bearer_token, _strict_response_validation=True)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
assert request.headers.get("Authorization") == f"Bearer {bearer_token}"

with pytest.raises(StudioSDKError):
with update_env(**{"STUDIO_SDK_BEARER_TOKEN": Omit()}):
client2 = StudioSDK(base_url=base_url, bearer_token=None, _strict_response_validation=True)
_ = client2

def test_default_query_option(self) -> None:
client = StudioSDK(
base_url=base_url,
Expand Down Expand Up @@ -1047,6 +1058,16 @@ def test_default_headers_option(self) -> None:
assert request.headers.get("x-foo") == "stainless"
assert request.headers.get("x-stainless-lang") == "my-overriding-header"

def test_validate_headers(self) -> None:
client = AsyncStudioSDK(base_url=base_url, bearer_token=bearer_token, _strict_response_validation=True)
request = client._build_request(FinalRequestOptions(method="get", url="/foo"))
assert request.headers.get("Authorization") == f"Bearer {bearer_token}"

with pytest.raises(StudioSDKError):
with update_env(**{"STUDIO_SDK_BEARER_TOKEN": Omit()}):
client2 = AsyncStudioSDK(base_url=base_url, bearer_token=None, _strict_response_validation=True)
_ = client2

def test_default_query_option(self) -> None:
client = AsyncStudioSDK(
base_url=base_url,
Expand Down

0 comments on commit 53eb20d

Please sign in to comment.