feat: widen token parameter to accept plain strings and add TCP keepalive support - #225
Closed
fern-api[bot] wants to merge 4 commits into
Closed
fern-api[bot] wants to merge 4 commits into
fern-api[bot] wants to merge 4 commits into
Conversation
Generated by Fern CLI Version: unknown Generators: - fernapi/fern-python-sdk: 5.30.0
…s and add TCP keepalive support
Expand the `token` parameter on both `PhenomlClient` and `AsyncPhenomlClient`
to accept either a raw bearer token string or a callable that returns one,
making static-token usage simpler without requiring a lambda wrapper.
Add TCP keepalive socket options via a new `get_keepalive_socket_options`
helper so that long-lived idle connections survive firewall and NAT reaping.
Introduce `optional_body` support in the HTTP client layer: endpoints whose
request body is entirely optional now send no content and no `Content-Type`
header when the caller omits every property, rather than sending an empty
`{}` payload.
Refactor `_coerce_keys_to_aliases` and the per-class alias cache in
`pydantic_utilities.py` into shared helpers (`_get_field_aliases`,
`_coerce_keys_to_aliases`) backed by a `WeakKeyDictionary` to avoid
redundant field introspection on every validation call.
Update `httpx-aiohttp` version constraint from a pinned `0.1.8` to `^0.1.8`
to allow compatible patch and minor upgrades.
Key changes:
- `PhenomlClient` and `AsyncPhenomlClient` `token` parameter widened from `Callable[[], str]` to `Union[str, Callable[[], str]]`
- New `get_keepalive_socket_options()` helper in `http_client.py` for cross-platform TCP keepalive configuration
- New `drop_content_type_without_body()` helper and `optional_body` flag on all `HttpClient` / `AsyncHttpClient` request methods to suppress empty-body requests and their `Content-Type` headers
- Alias-coercion logic in `UniversalBaseModel` extracted into cached `_get_field_aliases` / `_coerce_keys_to_aliases` module-level helpers
- `httpx-aiohttp` dependency relaxed to `^0.1.8`
🌿 Generated with Fern
Patches applied (1): - patch-6516695e: Release 15.0.2: restore bundled openapi.json packaging (#169)
…22da8f00226a65e6 [skip ci]
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4daa2e8. Configure here.
|
|
||
| headers: typing.Dict[str, str] = { | ||
| "User-Agent": "phenoml/17.0.0", | ||
| "User-Agent": "phenoml/0.0.0-fern-placeholder", |
There was a problem hiding this comment.
Placeholder User-Agent shipped in requests
Medium Severity
Every request now sends User-Agent: phenoml/0.0.0-fern-placeholder instead of the real SDK version. X-Fern-SDK-Version was updated to 17.1.0, but the User-Agent still has the Fern generator placeholder, so servers and analytics see a bogus client version.
Reviewed by Cursor Bugbot for commit 4daa2e8. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


17.0.0 → 17.1.0
Added
client.lang2fhir_batch— new sync and async client for async batch FHIR extraction, supporting the full job lifecycle viacreate(),upload_item(),finalize(),cancel(),get(),get_results(), andget_result().client.profiles.versions— new sync and async client for managing immutable retained StructureDefinition versions withlist(),create(),get(), anddelete()methods.BatchJob,BatchError,BatchCounts,BatchItemStatus,UploadItemResponse,JobDetailResponse,ResultsPageResponse,JobListResponse,ProfileVersionCreateRequest, andProfileVersionListResponseadded to support the new batch and profile-version APIs.ProfileSummary.status,.date, and.canonical— new optional fields exposing each profile's publication status, authored date, and canonical URL.get_keepalive_socket_options()— new helper that builds cross-platform TCP keepalive socket options for use withhttpxtransports, keeping long-lived idle connections alive through firewalls and NAT devices.BaseHttpResponse.response— new property exposing the underlyinghttpx.Responseobject for direct access to raw headers, cookies, and other HTTP metadata.quote_path_param()— new utility that percent-encodes path segment values (including/and..), preventing path traversal issues when building URLs from user-supplied data.optional_bodysupport in the HTTP client — endpoints with a fully optional request body now omit the body andContent-Typeheader entirely when no properties are provided, instead of sending an empty{}payload.Changed
PhenomlClientandAsyncPhenomlClienttokenparameter — now acceptsUnion[str, Callable[[], str]], so a raw bearer token string can be passed directly without wrapping it in a lambda.UniversalBaseModelalias-coercion — field-alias introspection is now cached per model class via aWeakKeyDictionary, reducing repeated reflection overhead on high-throughput validation paths.Fixed
See full changelog
✅ Customizations automatically preserved in this update.
Note
Medium Risk
Touches authentication (token typing, OAuth grant type), request encoding, and streaming behavior across the generated client; new batch/profile-version APIs expand the public surface but are additive.
Overview
Release 17.1.0 regenerates the Python SDK from an updated API spec (Fern 5.30.0) and bumps package metadata, lockfiles, and bundled
openapi.json.New API surface includes
client.lang2fhir_batch(async batch FHIR job lifecycle) andclient.profiles.versions(retained StructureDefinition versions), plus supporting Pydantic models and extraProfileSummaryfields (status,date,canonical).Client/runtime behavior changes:
tokenmay be a plain string or a callable; OAuth refresh now sendsgrant_type=client_credentials;instance_urlonly fillsbase_urlwhen it was not already set. The HTTP stack addsoptional_body(no body / noContent-Typewhen all fields are omitted),quote_path_param(),get_keepalive_socket_options(), andBaseHttpResponse.response. Agent chat SSE skips empty data frames instead of ending the stream early.UniversalBaseModelcaches alias metadata for faster validation.Tests and WireMock mappings were updated for bodyless optional requests and Bearer auth on stubbed calls; optional
httpx-aiohttpis relaxed to^0.1.8(lock resolves to 0.1.12).Reviewed by Cursor Bugbot for commit 4daa2e8. Bugbot is set up for automated code reviews on this repo. Configure here.