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
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"cliVersion": "4.3.3",
"cliVersion": "4.17.0",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "4.61.4",
"generatorVersion": "4.61.5",
"generatorConfig": {
"client_class_name": "PhenomlClient"
},
"sdkVersion": "8.0.1"
"sdkVersion": "8.1.0"
}
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 8.1.0 - 2026-03-09
* feat: add ServiceUnavailableError and TooManyRequestsError handling
* Add comprehensive error handling for HTTP 429 (Too Many Requests) and HTTP 503 (Service Unavailable) status codes across all FHIR client methods. This improves the client's robustness by properly handling rate limiting and temporary service unavailability scenarios.
* Key changes:
* Add ServiceUnavailableError class for HTTP 503 responses
* Add TooManyRequestsError class for HTTP 429 responses with structured ErrorResponse body
* Update all sync and async client methods to handle these new error types
* Add proper imports and exports in module initialization files
* 🌿 Generated with Fern

## 8.0.0 - 2026-03-04

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "phenoml"
version = "8.0.1"
version = "8.1.0"
description = ""
readme = "README.md"
authors = []
Expand Down
4 changes: 2 additions & 2 deletions src/phenoml/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform

headers: typing.Dict[str, str] = {
"User-Agent": "phenoml/8.0.1",
"User-Agent": "phenoml/8.1.0",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "phenoml",
"X-Fern-SDK-Version": "8.0.1",
"X-Fern-SDK-Version": "8.1.0",
**(self.get_custom_headers() or {}),
}
token = self._get_token()
Expand Down
14 changes: 13 additions & 1 deletion src/phenoml/fhir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
FhirResourceMeta,
FhirSearchResponse,
)
from .errors import BadGatewayError, BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
from .errors import (
BadGatewayError,
BadRequestError,
InternalServerError,
NotFoundError,
ServiceUnavailableError,
TooManyRequestsError,
UnauthorizedError,
)
_dynamic_imports: typing.Dict[str, str] = {
"BadGatewayError": ".errors",
"BadRequestError": ".errors",
Expand All @@ -36,6 +44,8 @@
"FhirSearchResponse": ".types",
"InternalServerError": ".errors",
"NotFoundError": ".errors",
"ServiceUnavailableError": ".errors",
"TooManyRequestsError": ".errors",
"UnauthorizedError": ".errors",
}

Expand Down Expand Up @@ -77,5 +87,7 @@ def __dir__():
"FhirSearchResponse",
"InternalServerError",
"NotFoundError",
"ServiceUnavailableError",
"TooManyRequestsError",
"UnauthorizedError",
]
14 changes: 13 additions & 1 deletion src/phenoml/fhir/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
from .bad_request_error import BadRequestError
from .internal_server_error import InternalServerError
from .not_found_error import NotFoundError
from .service_unavailable_error import ServiceUnavailableError
from .too_many_requests_error import TooManyRequestsError
from .unauthorized_error import UnauthorizedError
_dynamic_imports: typing.Dict[str, str] = {
"BadGatewayError": ".bad_gateway_error",
"BadRequestError": ".bad_request_error",
"InternalServerError": ".internal_server_error",
"NotFoundError": ".not_found_error",
"ServiceUnavailableError": ".service_unavailable_error",
"TooManyRequestsError": ".too_many_requests_error",
"UnauthorizedError": ".unauthorized_error",
}

Expand All @@ -41,4 +45,12 @@ def __dir__():
return sorted(lazy_attrs)


__all__ = ["BadGatewayError", "BadRequestError", "InternalServerError", "NotFoundError", "UnauthorizedError"]
__all__ = [
"BadGatewayError",
"BadRequestError",
"InternalServerError",
"NotFoundError",
"ServiceUnavailableError",
"TooManyRequestsError",
"UnauthorizedError",
]
10 changes: 10 additions & 0 deletions src/phenoml/fhir/errors/service_unavailable_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was auto-generated by Fern from our API Definition.

import typing

from ...core.api_error import ApiError


class ServiceUnavailableError(ApiError):
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
super().__init__(status_code=503, headers=headers, body=body)
11 changes: 11 additions & 0 deletions src/phenoml/fhir/errors/too_many_requests_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was auto-generated by Fern from our API Definition.

import typing

from ...core.api_error import ApiError
from ..types.error_response import ErrorResponse


class TooManyRequestsError(ApiError):
def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
super().__init__(status_code=429, headers=headers, body=body)
Loading
Loading