diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 507912c5..cf1dd2b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.42.0" + ".": "1.42.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c960fa0..20f99727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 1.42.1 (2024-02-04) + +Full Changelog: [v1.42.0...v1.42.1](https://github.com/orbcorp/orb-python/compare/v1.42.0...v1.42.1) + +### Bug Fixes + +* prevent crash when platform.architecture() is not allowed ([#163](https://github.com/orbcorp/orb-python/issues/163)) ([20629a0](https://github.com/orbcorp/orb-python/commit/20629a05e67981b09a3b506ae32e5d3d64ca9420)) + + +### Chores + +* **interal:** make link to api.md relative ([#161](https://github.com/orbcorp/orb-python/issues/161)) ([7710cdc](https://github.com/orbcorp/orb-python/commit/7710cdcad2adeaa76d1ff7f7ee6e149a5e67c451)) + ## 1.42.0 (2024-02-01) Full Changelog: [v1.41.0...v1.42.0](https://github.com/orbcorp/orb-python/compare/v1.41.0...v1.42.0) diff --git a/README.md b/README.md index c2fe0f57..039d8b95 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ and offers both synchronous and asynchronous clients powered by [httpx](https:// ## Documentation -The REST API documentation can be found [on docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](https://www.github.com/orbcorp/orb-python/blob/main/api.md). +The REST API documentation can be found [on docs.withorb.com](https://docs.withorb.com/reference/api-reference). The full API of this library can be found in [api.md](api.md). ## Installation @@ -18,7 +18,7 @@ pip install orb-billing ## Usage -The full API of this library can be found in [api.md](https://www.github.com/orbcorp/orb-python/blob/main/api.md). +The full API of this library can be found in [api.md](api.md). ```python import os diff --git a/pyproject.toml b/pyproject.toml index 9d9ecc3d..ec6123c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "1.42.0" +version = "1.42.1" description = "The official Python library for the orb API" readme = "README.md" license = "Apache-2.0" diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index d7e5127d..73bd2411 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -1836,8 +1836,12 @@ def __str__(self) -> str: def get_platform() -> Platform: - system = platform.system().lower() - platform_name = platform.platform().lower() + try: + system = platform.system().lower() + platform_name = platform.platform().lower() + except Exception: + return "Unknown" + if "iphone" in platform_name or "ipad" in platform_name: # Tested using Python3IDE on an iPhone 11 and Pythonista on an iPad 7 # system is Darwin and platform_name is a string like: @@ -1880,8 +1884,8 @@ def platform_headers(version: str) -> Dict[str, str]: "X-Stainless-Package-Version": version, "X-Stainless-OS": str(get_platform()), "X-Stainless-Arch": str(get_architecture()), - "X-Stainless-Runtime": platform.python_implementation(), - "X-Stainless-Runtime-Version": platform.python_version(), + "X-Stainless-Runtime": get_python_runtime(), + "X-Stainless-Runtime-Version": get_python_version(), } @@ -1897,9 +1901,27 @@ def __str__(self) -> str: Arch = Union[OtherArch, Literal["x32", "x64", "arm", "arm64", "unknown"]] +def get_python_runtime() -> str: + try: + return platform.python_implementation() + except Exception: + return "unknown" + + +def get_python_version() -> str: + try: + return platform.python_version() + except Exception: + return "unknown" + + def get_architecture() -> Arch: - python_bitness, _ = platform.architecture() - machine = platform.machine().lower() + try: + python_bitness, _ = platform.architecture() + machine = platform.machine().lower() + except Exception: + return "unknown" + if machine in ("arm64", "aarch64"): return "arm64" diff --git a/src/orb/_version.py b/src/orb/_version.py index 15ae6bd1..f016ce96 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. __title__ = "orb" -__version__ = "1.42.0" # x-release-please-version +__version__ = "1.42.1" # x-release-please-version