helix.fhir.client.sdk 4.2.16__py3-none-any.whl → 4.2.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,7 +170,8 @@ class FhirAuthMixin(FhirClientProtocol):
170
170
  :return: auth server url or None
171
171
  """
172
172
  async with RetryableAioHttpClient(
173
- fn_get_session=lambda: self.create_http_session(),
173
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
174
+ caller_managed_session=self._fn_create_http_session is not None,
174
175
  exclude_status_codes_from_retry=[404],
175
176
  throw_exception_on_error=False,
176
177
  use_data_streaming=False,
@@ -272,7 +273,8 @@ class FhirAuthMixin(FhirClientProtocol):
272
273
  }
273
274
 
274
275
  async with RetryableAioHttpClient(
275
- fn_get_session=lambda: self.create_http_session(),
276
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
277
+ caller_managed_session=self._fn_create_http_session is not None,
276
278
  use_data_streaming=False,
277
279
  compress=False,
278
280
  exclude_status_codes_from_retry=None,
@@ -846,16 +846,13 @@ class FhirClient(
846
846
 
847
847
  def create_http_session(self) -> ClientSession:
848
848
  """
849
- Creates an HTTP Session.
849
+ Creates the SDK's default HTTP Session.
850
850
 
851
- If a custom session factory was set via use_http_session(), it will be used.
852
- Otherwise, creates a default aiohttp ClientSession with standard configuration.
853
- """
854
- # Use a custom session factory if provided
855
- if self._fn_create_http_session is not None:
856
- return self._fn_create_http_session()
851
+ This method always creates a new aiohttp ClientSession with standard configuration.
852
+ The SDK manages the lifecycle of sessions created by this method.
857
853
 
858
- # Default implementation
854
+ Note: If you want to provide your own session factory, use use_http_session() instead.
855
+ """
859
856
  trace_config = aiohttp.TraceConfig()
860
857
  # trace_config.on_request_start.append(on_request_start)
861
858
  if self._log_level == "DEBUG":
@@ -56,7 +56,8 @@ class FhirDeleteMixin(FhirClientProtocol):
56
56
  headers["Authorization"] = f"Bearer {access_token}"
57
57
 
58
58
  async with RetryableAioHttpClient(
59
- fn_get_session=lambda: self.create_http_session(),
59
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
60
+ caller_managed_session=self._fn_create_http_session is not None,
60
61
  refresh_token_func=self._refresh_token_function,
61
62
  retries=self._retry_count,
62
63
  exclude_status_codes_from_retry=self._exclude_status_codes_from_retry,
@@ -129,7 +130,8 @@ class FhirDeleteMixin(FhirClientProtocol):
129
130
  headers["Authorization"] = f"Bearer {access_token}"
130
131
 
131
132
  async with RetryableAioHttpClient(
132
- fn_get_session=lambda: self.create_http_session(),
133
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
134
+ caller_managed_session=self._fn_create_http_session is not None,
133
135
  refresh_token_func=self._refresh_token_function,
134
136
  retries=self._retry_count,
135
137
  exclude_status_codes_from_retry=self._exclude_status_codes_from_retry,
@@ -54,11 +54,12 @@ class FhirMergeMixin(FhirClientProtocol):
54
54
  access_token: str | None = access_token_result.access_token
55
55
 
56
56
  await AsyncFhirValidator.validate_fhir_resource(
57
- fn_get_session=lambda: self.create_http_session(),
57
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
58
58
  json_data=json.dumps(resource_json),
59
59
  resource_name=cast(str | None, resource_json.get("resourceType")) or self._resource or "",
60
60
  validation_server_url=self._validation_server_url,
61
61
  access_token=access_token,
62
+ caller_managed_session=self._fn_create_http_session is not None,
62
63
  )
63
64
  resource_json_list_clean.append(resource_json)
64
65
  except FhirValidationException as e:
@@ -75,11 +76,12 @@ class FhirMergeMixin(FhirClientProtocol):
75
76
  access_token_result1: GetAccessTokenResult = await self.get_access_token_async()
76
77
  access_token1: str | None = access_token_result1.access_token
77
78
  await AsyncFhirValidator.validate_fhir_resource(
78
- fn_get_session=lambda: self.create_http_session(),
79
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
79
80
  json_data=json.dumps(resource_json),
80
81
  resource_name=resource_json.get("resourceType") or self._resource or "",
81
82
  validation_server_url=self._validation_server_url,
82
83
  access_token=access_token1,
84
+ caller_managed_session=self._fn_create_http_session is not None,
83
85
  )
84
86
  resource_json_list_clean.append(resource_json)
85
87
  except FhirValidationException as e:
@@ -183,7 +185,8 @@ class FhirMergeMixin(FhirClientProtocol):
183
185
  response_text: str | None = None
184
186
  try:
185
187
  async with RetryableAioHttpClient(
186
- fn_get_session=lambda: self.create_http_session(),
188
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
189
+ caller_managed_session=self._fn_create_http_session is not None,
187
190
  refresh_token_func=self._refresh_token_function,
188
191
  tracer_request_func=self._trace_request_function,
189
192
  retries=self._retry_count,
@@ -299,7 +299,8 @@ class FhirMergeResourcesMixin(FhirClientProtocol):
299
299
  response_text: str | None = None
300
300
  try:
301
301
  async with RetryableAioHttpClient(
302
- fn_get_session=lambda: self.create_http_session(),
302
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
303
+ caller_managed_session=self._fn_create_http_session is not None,
303
304
  refresh_token_func=self._refresh_token_function,
304
305
  tracer_request_func=self._trace_request_function,
305
306
  retries=self._retry_count,
@@ -515,7 +516,8 @@ class FhirMergeResourcesMixin(FhirClientProtocol):
515
516
  response_text: str | None = None
516
517
  try:
517
518
  async with RetryableAioHttpClient(
518
- fn_get_session=lambda: self.create_http_session(),
519
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
520
+ caller_managed_session=self._fn_create_http_session is not None,
519
521
  refresh_token_func=self._refresh_token_function,
520
522
  tracer_request_func=self._trace_request_function,
521
523
  retries=self._retry_count,
@@ -675,11 +677,12 @@ class FhirMergeResourcesMixin(FhirClientProtocol):
675
677
  access_token: str | None = access_token_result.access_token
676
678
 
677
679
  await AsyncFhirValidator.validate_fhir_resource(
678
- fn_get_session=lambda: self.create_http_session(),
680
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
679
681
  json_data=resource.json(),
680
682
  resource_name=cast(str | None, resource.get("resourceType")) or self._resource or "",
681
683
  validation_server_url=self._validation_server_url,
682
684
  access_token=access_token,
685
+ caller_managed_session=self._fn_create_http_session is not None,
683
686
  )
684
687
  resource_json_list_clean.append(resource)
685
688
  except FhirValidationException as e:
@@ -700,11 +703,12 @@ class FhirMergeResourcesMixin(FhirClientProtocol):
700
703
  try:
701
704
  with resource.transaction():
702
705
  await AsyncFhirValidator.validate_fhir_resource(
703
- fn_get_session=lambda: self.create_http_session(),
706
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
704
707
  json_data=resource.json(),
705
708
  resource_name=resource.get("resourceType") or self._resource or "",
706
709
  validation_server_url=self._validation_server_url,
707
710
  access_token=access_token1,
711
+ caller_managed_session=self._fn_create_http_session is not None,
708
712
  )
709
713
  resource_json_list_clean.append(resource)
710
714
  except FhirValidationException as e:
@@ -71,7 +71,8 @@ class FhirPatchMixin(FhirClientProtocol):
71
71
  deserialized_data = json.loads(data)
72
72
  # actually make the request
73
73
  async with RetryableAioHttpClient(
74
- fn_get_session=lambda: self.create_http_session(),
74
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
75
+ caller_managed_session=self._fn_create_http_session is not None,
75
76
  refresh_token_func=self._refresh_token_function,
76
77
  tracer_request_func=self._trace_request_function,
77
78
  retries=self._retry_count,
@@ -96,16 +96,18 @@ class FhirUpdateMixin(FhirClientProtocol):
96
96
 
97
97
  if self._validation_server_url:
98
98
  await AsyncFhirValidator.validate_fhir_resource(
99
- fn_get_session=lambda: self.create_http_session(),
99
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
100
100
  json_data=json_data,
101
101
  resource_name=self._resource,
102
102
  validation_server_url=self._validation_server_url,
103
103
  access_token=access_token,
104
+ caller_managed_session=self._fn_create_http_session is not None,
104
105
  )
105
106
 
106
107
  # actually make the request
107
108
  async with RetryableAioHttpClient(
108
- fn_get_session=lambda: self.create_http_session(),
109
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
110
+ caller_managed_session=self._fn_create_http_session is not None,
109
111
  refresh_token_func=self._refresh_token_function,
110
112
  tracer_request_func=self._trace_request_function,
111
113
  retries=self._retry_count,
@@ -119,7 +119,8 @@ class RequestQueueMixin(ABC, FhirClientProtocol):
119
119
  )
120
120
 
121
121
  async with RetryableAioHttpClient(
122
- fn_get_session=lambda: self.create_http_session(),
122
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
123
+ caller_managed_session=self._fn_create_http_session is not None,
123
124
  refresh_token_func=self._refresh_token_function,
124
125
  tracer_request_func=self._trace_request_function,
125
126
  retries=self._retry_count,
@@ -287,7 +288,8 @@ class RequestQueueMixin(ABC, FhirClientProtocol):
287
288
  )
288
289
 
289
290
  async with RetryableAioHttpClient(
290
- fn_get_session=lambda: self.create_http_session(),
291
+ fn_get_session=self._fn_create_http_session or self.create_http_session,
292
+ caller_managed_session=self._fn_create_http_session is not None,
291
293
  refresh_token_func=self._refresh_token_function,
292
294
  tracer_request_func=self._trace_request_function,
293
295
  retries=self._retry_count,
@@ -37,6 +37,7 @@ class RetryableAioHttpClient:
37
37
  refresh_token_func: RefreshTokenFunction | None,
38
38
  tracer_request_func: TraceRequestFunction | None,
39
39
  fn_get_session: Callable[[], ClientSession] | None = None,
40
+ caller_managed_session: bool = False,
40
41
  exclude_status_codes_from_retry: list[int] | None = None,
41
42
  use_data_streaming: bool | None,
42
43
  compress: bool | None = False,
@@ -50,9 +51,9 @@ class RetryableAioHttpClient:
50
51
  RetryableClient provides a way to make HTTP calls with automatic retry and automatic refreshing of access tokens.
51
52
 
52
53
  Session Lifecycle Management:
53
- - If fn_get_session is None (default): The SDK creates and manages the session lifecycle.
54
+ - If caller_managed_session is False (default): The SDK manages the session lifecycle.
54
55
  The session will be automatically closed when exiting the context manager.
55
- - If fn_get_session is provided: The caller is responsible for managing the session lifecycle.
56
+ - If caller_managed_session is True: The caller is responsible for managing the session lifecycle.
56
57
  The SDK will NOT close the session - the caller must close it themselves.
57
58
 
58
59
  :param retries: Number of retry attempts for failed requests
@@ -61,8 +62,10 @@ class RetryableAioHttpClient:
61
62
  :param retry_status_codes: HTTP status codes that trigger a retry
62
63
  :param refresh_token_func: Function to refresh authentication tokens
63
64
  :param tracer_request_func: Function to trace/log requests
64
- :param fn_get_session: Optional callable that returns a ClientSession. If provided,
65
- the caller is responsible for closing the session.
65
+ :param fn_get_session: Optional callable that returns a ClientSession. If None, a basic
66
+ ClientSession will be created internally.
67
+ :param caller_managed_session: If True, the caller is responsible for closing the session.
68
+ If False (default), the SDK will close the session on exit.
66
69
  :param exclude_status_codes_from_retry: Status codes to exclude from retry logic
67
70
  :param use_data_streaming: Whether to stream response data
68
71
  :param compress: Whether to compress request data
@@ -80,8 +83,8 @@ class RetryableAioHttpClient:
80
83
  )
81
84
  self.refresh_token_func_async: RefreshTokenFunction | None = refresh_token_func
82
85
  self.trace_function_async: TraceRequestFunction | None = tracer_request_func
83
- # Automatically determine if a session is caller-managed based on whether fn_get_session is provided
84
- self._caller_managed_session: bool = fn_get_session is not None
86
+ self._caller_managed_session: bool = caller_managed_session
87
+ # If no session factory provided, use a default one that creates a basic ClientSession
85
88
  self.fn_get_session: Callable[[], ClientSession] = (
86
89
  fn_get_session if fn_get_session is not None else lambda: ClientSession()
87
90
  )
@@ -23,6 +23,7 @@ class AsyncFhirValidator:
23
23
  resource_name: str,
24
24
  validation_server_url: str,
25
25
  access_token: str | None,
26
+ caller_managed_session: bool = False,
26
27
  ) -> None:
27
28
  """
28
29
  Calls the validation server url to validate the given resource
@@ -32,6 +33,7 @@ class AsyncFhirValidator:
32
33
  :param resource_name: name of resource
33
34
  :param validation_server_url: url to validation server
34
35
  :param access_token: access token to use
36
+ :param caller_managed_session: if True, the caller is responsible for closing the session
35
37
  """
36
38
  # check each resource against the validation server
37
39
  headers = {"Content-Type": "application/fhir+json"}
@@ -42,6 +44,7 @@ class AsyncFhirValidator:
42
44
  full_validation_uri /= "$validate"
43
45
  async with RetryableAioHttpClient(
44
46
  fn_get_session=fn_get_session,
47
+ caller_managed_session=caller_managed_session,
45
48
  use_data_streaming=False,
46
49
  access_token=access_token,
47
50
  access_token_expiry_date=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: helix.fhir.client.sdk
3
- Version: 4.2.16
3
+ Version: 4.2.17
4
4
  Summary: helix.fhir.client.sdk
5
5
  Home-page: https://github.com/icanbwell/helix.fhir.client.sdk
6
6
  Author: Imran Qureshi
@@ -1,14 +1,14 @@
1
1
  helix_fhir_client_sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  helix_fhir_client_sdk/dictionary_parser.py,sha256=WrGkVAxMlUvVycRVrX7UZt2oP2e_Vk4-E8QibwTpHLM,3401
3
3
  helix_fhir_client_sdk/dictionary_writer.py,sha256=V7Bx9Z69s0LRYF6Lc6Xp0d-Gj0BnAVKA1vBuwf3JORE,1486
4
- helix_fhir_client_sdk/fhir_auth_mixin.py,sha256=L-_fwQbyojv6AoRUYkPSXWEsW7NRInvJ3wwYgINEtJs,14351
4
+ helix_fhir_client_sdk/fhir_auth_mixin.py,sha256=IZbqG_JtABVvN-_xxFrbupe97Hnc7cNoA2l0D3y0gf8,14549
5
5
  helix_fhir_client_sdk/fhir_bundle_appender.py,sha256=t1hs7p_vXKC9MUFyUnN9dTuDhRF-kw-kkgVFtGHv9QQ,11749
6
- helix_fhir_client_sdk/fhir_client.py,sha256=dHfkruJZ1uPM4cmKcnn4HqI0BCDP3IwIqXSLvCu4IsY,37346
7
- helix_fhir_client_sdk/fhir_delete_mixin.py,sha256=IRcJ5AJ7yrsc1HbjqYW5-jAcIEwG__9nEqwbvvC8qJ0,7532
8
- helix_fhir_client_sdk/fhir_merge_mixin.py,sha256=h2lvpLDs5nvt9F1bcpd110LFuFXI2HW-uKrUs5TbW7I,17783
9
- helix_fhir_client_sdk/fhir_merge_resources_mixin.py,sha256=QO2SeZa4Co69f_2YCz0_ss2dJb4xhVMkRdzbjLIJ-iI,35799
10
- helix_fhir_client_sdk/fhir_patch_mixin.py,sha256=QLTsqhFLGi4gC_qQblnCA4skdiLw8h4QRlzvaeyFkl4,7249
11
- helix_fhir_client_sdk/fhir_update_mixin.py,sha256=_Yx9yg809N8EXY07XlwHxSJLp-xIzpNg5erL92LOeww,7370
6
+ helix_fhir_client_sdk/fhir_client.py,sha256=G6arOw76vcwSkcfAgPHLbOK-B5eWymNMRNygoKIx6FA,37262
7
+ helix_fhir_client_sdk/fhir_delete_mixin.py,sha256=1vgbbBGxXGwp1ay58Du_jWI75BjgfMKtdm5E7A0Oo7U,7738
8
+ helix_fhir_client_sdk/fhir_merge_mixin.py,sha256=ubROibX14IC8iu7CyTKV3KbO34nCJTir3oCT8Gfah_I,18124
9
+ helix_fhir_client_sdk/fhir_merge_resources_mixin.py,sha256=Jynsew9iMWTPeNJ979Dm8EB6DLsc3ddDMeywmeAU6uU,36251
10
+ helix_fhir_client_sdk/fhir_patch_mixin.py,sha256=xFn4RIjGBwnZuIV4eD8E_Yk7lRbwkW6SBHkoNqMz_mk,7360
11
+ helix_fhir_client_sdk/fhir_update_mixin.py,sha256=NQ_6_UHzlFztnH_OrChl6dicC6hR-qBBnPToqZAe_X4,7588
12
12
  helix_fhir_client_sdk/function_types.py,sha256=x95j6ix3Xa9b276Q741xX1jguqBuFT6EBLDw35_EoVM,3916
13
13
  helix_fhir_client_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  helix_fhir_client_sdk/well_known_configuration.py,sha256=hwKpqZoJHkHuCEOowoXk07ywEMMhr_rcmQHNKCUEgVk,221
@@ -41,7 +41,7 @@ helix_fhir_client_sdk/open_telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
41
41
  helix_fhir_client_sdk/open_telemetry/attribute_names.py,sha256=mcPcgpaRe-hZDmPu8gLQo51E_-rllAk2OXMC9uK6EmM,328
42
42
  helix_fhir_client_sdk/open_telemetry/span_names.py,sha256=sEuzUXxE9pSoAZti2YVifBqbo3r4SLTPlIUW4F2EuP0,548
43
43
  helix_fhir_client_sdk/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- helix_fhir_client_sdk/queue/request_queue_mixin.py,sha256=Q5ZyadT2nMX6TATsiy0FLXzzCpTbVjN0Gh-B_F0RGCk,21684
44
+ helix_fhir_client_sdk/queue/request_queue_mixin.py,sha256=5Oc5lE-9Mu8R6gBcu6a3HUEvWllIzbF2OFXCTD6W2h8,21890
45
45
  helix_fhir_client_sdk/responses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  helix_fhir_client_sdk/responses/bundle_expander.py,sha256=ilR5eMgciSgzsdQvKB6bHtn9jtpvn3uS-EBz-hrahzo,1065
47
47
  helix_fhir_client_sdk/responses/fhir_client_protocol.py,sha256=IWM7LNQ1ZbgaySLGqpCwWAKyArT5HgBdNhkmSEivNMo,7100
@@ -104,7 +104,7 @@ helix_fhir_client_sdk/utilities/hash_util.py,sha256=YNUy7-IC_OtC0l-T45UO9UkA-_ps
104
104
  helix_fhir_client_sdk/utilities/list_chunker.py,sha256=2h2k5CCFmOhICaugOx6UI-9dh4q5w1lVdF7WQLX0LCM,1456
105
105
  helix_fhir_client_sdk/utilities/ndjson_chunk_streaming_parser.py,sha256=3TCYfWVCEpJbqRxqlSDsGnFnraO4T9bxzYdShvu6Pos,1954
106
106
  helix_fhir_client_sdk/utilities/practitioner_generator.py,sha256=gneCAXNDNEphBY-Nc2nMQBbEWJgHcjvv3S8JQ75yiJI,3778
107
- helix_fhir_client_sdk/utilities/retryable_aiohttp_client.py,sha256=8DdzqTmIY1hWlxmEXOxycBpa72wTo-vsAtcLO4hpnmQ,22605
107
+ helix_fhir_client_sdk/utilities/retryable_aiohttp_client.py,sha256=ytM4wSpxVLrAp30QtCWnu6SpPac4-Gzwv8d86GmtFgk,22827
108
108
  helix_fhir_client_sdk/utilities/retryable_aiohttp_response.py,sha256=DvNX6WO1m2Hz6LoI5CwSPDECPd8oDsqRCVsyq_Oxf-0,3542
109
109
  helix_fhir_client_sdk/utilities/retryable_aiohttp_url_result.py,sha256=Gdmvn6qIM2JF0YOhobQUHY41fCxvYyaths_CZs0iJfo,616
110
110
  helix_fhir_client_sdk/utilities/url_checker.py,sha256=_JRSIvu7WNXh2OA79HJbEEiomGT-quGhAUGh44-9824,3580
@@ -126,11 +126,11 @@ helix_fhir_client_sdk/utilities/test/test_list_chunker.py,sha256=n9J9UZqdluCp2AH
126
126
  helix_fhir_client_sdk/utilities/test/test_ndjson_chunk_streaming_parser.py,sha256=scwktyIIHSRKpw_GTHI4Uj0SsKy3OY4Yf5v5rZGBZXk,5343
127
127
  helix_fhir_client_sdk/utilities/test/test_retryable_aiohttp_client.py,sha256=EeYiYktiLUDTvp5jpJWi7-Qyip4gmI55BJzEhbLpGiE,19121
128
128
  helix_fhir_client_sdk/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- helix_fhir_client_sdk/validators/async_fhir_validator.py,sha256=Bgiw5atbc5YzBYpkV68oJYFz0uaXZzEg2rgORTH_6PM,3676
129
+ helix_fhir_client_sdk/validators/async_fhir_validator.py,sha256=i1BC98hZF6JhMQQzolEAuxQXCP4CMiRewiuQ1ufe0yQ,3879
130
130
  helix_fhir_client_sdk/validators/fhir_validator.py,sha256=HWBldSEB9yeKIcnLcV8R-LoTzwT_OMu8SchtUUBKzys,2331
131
131
  helix_fhir_client_sdk/validators/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
132
  helix_fhir_client_sdk/validators/test/test_async_fhir_validator.py,sha256=RmSowjPUdZee5nYuYujghxWyqJ20cu7U0lJFtFT-ZBs,3285
133
- helix_fhir_client_sdk-4.2.16.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
133
+ helix_fhir_client_sdk-4.2.17.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
134
134
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
135
  tests/logger_for_test.py,sha256=UC-7F6w6fDsUIYf37aRnvUdiUUVk8qkJEUSuO17NQnI,1525
136
136
  tests/test_fhir_client_clone.py,sha256=c5y1rWJ32nBSUnK1FfyymY005dNowd4Nf1xrbuQolNk,5368
@@ -153,7 +153,7 @@ tests/async/test_async_real_fhir_server_get_patients.py,sha256=0oMnUJg1KEspJ5_4e
153
153
  tests/async/test_async_real_fhir_server_get_patients_error.py,sha256=_s7chLogAg0yKgGpsq1o9_dDHBrzGaRWBAo8agFTN6U,1914
154
154
  tests/async/test_benchmark_compress.py,sha256=q1gDG7qXvof-3uVAqJlZAW7uO8cR0vEeDfzl-iwIEtY,16470
155
155
  tests/async/test_benchmark_merge.py,sha256=ME0Pow_IXpIaVGWvq3ii7dGltXcz-3DGxz2gGF4LmYQ,19830
156
- tests/async/test_retryable_client_session_management.py,sha256=cOAE0wGkh3cv0AS187nujeial3gGEu1VlOJ5b9-LaCI,5360
156
+ tests/async/test_retryable_client_session_management.py,sha256=h6zTQCICbuz3NpShJc63V9yY_Aur9Fho16-LFDcb4oQ,5658
157
157
  tests/async/fhir_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
158
  tests/async/fhir_server/test_async_real_fhir_server_get_graph_large.py,sha256=fM2MPF47nDF2Qwj2AkdTZ2CfvgUYGN4AVIS253KC9MQ,9430
159
159
  tests/async/fhir_server/test_async_real_fhir_server_get_patients_large.py,sha256=rXRF8E8Al7XANCmef1d_WqxSA9TVQjVC7B41OZaEQlY,5583
@@ -213,7 +213,7 @@ tests_integration/test_emr_server_auth.py,sha256=2I4QUAspQN89uGf6JB2aVuYaBeDnRJz
213
213
  tests_integration/test_firely_fhir.py,sha256=ll6-plwQrKfdrEyfbw0wLTC1jB-Qei1Mj-81tYTl5eQ,697
214
214
  tests_integration/test_merge_vs_smart_merge_behavior.py,sha256=LrIuyxzw0YLaTjcRtG0jzy0M6xSv9qebmdBtMPDcacQ,3733
215
215
  tests_integration/test_staging_server_graph.py,sha256=5RfMxjhdX9o4-n_ZRvze4Sm8u8NjRijRLDpqiz8qD_0,7132
216
- helix_fhir_client_sdk-4.2.16.dist-info/METADATA,sha256=AHcaKMqC3ICIbjD_Fr8CXs8MxOXLzdyh3A76J-SVYMk,7210
217
- helix_fhir_client_sdk-4.2.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
218
- helix_fhir_client_sdk-4.2.16.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
219
- helix_fhir_client_sdk-4.2.16.dist-info/RECORD,,
216
+ helix_fhir_client_sdk-4.2.17.dist-info/METADATA,sha256=KP-b2VyDF8N0VPOshkF_8j7Du3oQgQlhCO5jCU8hHZg,7210
217
+ helix_fhir_client_sdk-4.2.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
218
+ helix_fhir_client_sdk-4.2.17.dist-info/top_level.txt,sha256=BRnDS6ceQxs-4u2jXznATObgP8G2cGAerlH0ZS4sJ6M,46
219
+ helix_fhir_client_sdk-4.2.17.dist-info/RECORD,,
@@ -42,12 +42,13 @@ async def test_user_provided_session_is_not_closed_after_exit() -> None:
42
42
 
43
43
  try:
44
44
  # Provide a factory that returns the user's session
45
- # Since fn_get_session is provided, SDK will NOT close the session
45
+ # Set caller_managed_session=True so SDK will NOT close the session
46
46
  client = RetryableAioHttpClient(
47
47
  retries=1,
48
48
  refresh_token_func=None,
49
49
  tracer_request_func=None,
50
50
  fn_get_session=lambda: user_session, # User provides a custom factory
51
+ caller_managed_session=True, # User manages session lifecycle
51
52
  use_data_streaming=False,
52
53
  access_token=None,
53
54
  access_token_expiry_date=None,
@@ -59,7 +60,7 @@ async def test_user_provided_session_is_not_closed_after_exit() -> None:
59
60
  assert not client.session.closed
60
61
 
61
62
  # After exiting context, the user's session should still be open
62
- # because fn_get_session was provided (caller manages session lifecycle)
63
+ # because caller_managed_session=True (caller manages session lifecycle)
63
64
  assert not user_session.closed
64
65
 
65
66
  finally:
@@ -81,6 +82,7 @@ async def test_multiple_clients_can_share_user_session() -> None:
81
82
  refresh_token_func=None,
82
83
  tracer_request_func=None,
83
84
  fn_get_session=lambda: shared_session,
85
+ caller_managed_session=True, # User manages session lifecycle
84
86
  use_data_streaming=False,
85
87
  access_token=None,
86
88
  access_token_expiry_date=None,
@@ -97,6 +99,7 @@ async def test_multiple_clients_can_share_user_session() -> None:
97
99
  refresh_token_func=None,
98
100
  tracer_request_func=None,
99
101
  fn_get_session=lambda: shared_session,
102
+ caller_managed_session=True, # User manages session lifecycle
100
103
  use_data_streaming=False,
101
104
  access_token=None,
102
105
  access_token_expiry_date=None,
@@ -132,6 +135,7 @@ async def test_user_can_recreate_closed_session_via_factory() -> None:
132
135
  refresh_token_func=None,
133
136
  tracer_request_func=None,
134
137
  fn_get_session=session_factory,
138
+ caller_managed_session=True, # User manages session lifecycle
135
139
  use_data_streaming=False,
136
140
  access_token=None,
137
141
  access_token_expiry_date=None,
@@ -140,7 +144,7 @@ async def test_user_can_recreate_closed_session_via_factory() -> None:
140
144
  created_sessions.append(client1.session)
141
145
  assert call_count == 1 # Factory called once in __aenter__
142
146
 
143
- # SDK doesn't close session (caller provided fn_get_session)
147
+ # SDK doesn't close session (caller_managed_session=True)
144
148
  assert created_sessions[0] is not None
145
149
  assert not created_sessions[0].closed
146
150