airbyte-cdk 6.57.3.post2.dev16088474497__py3-none-any.whl → 6.58.0__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.
@@ -2043,9 +2043,15 @@ definitions:
2043
2043
  - "$ref": "#/definitions/NoAuth"
2044
2044
  - "$ref": "#/definitions/LegacySessionTokenAuthenticator"
2045
2045
  fetch_properties_from_endpoint:
2046
+ deprecated: true
2047
+ deprecation_message: "Use `query_properties` field instead."
2046
2048
  title: Fetch Properties from Endpoint
2047
2049
  description: Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.
2048
2050
  "$ref": "#/definitions/PropertiesFromEndpoint"
2051
+ query_properties:
2052
+ title: Query Properties
2053
+ description: For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.
2054
+ "$ref": "#/definitions/QueryProperties"
2049
2055
  request_parameters:
2050
2056
  title: Query Parameters
2051
2057
  description: Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.
@@ -2543,9 +2543,16 @@ class HttpRequester(BaseModelWithDeprecations):
2543
2543
  )
2544
2544
  fetch_properties_from_endpoint: Optional[PropertiesFromEndpoint] = Field(
2545
2545
  None,
2546
+ deprecated=True,
2547
+ deprecation_message="Use `query_properties` field instead.",
2546
2548
  description="Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.",
2547
2549
  title="Fetch Properties from Endpoint",
2548
2550
  )
2551
+ query_properties: Optional[QueryProperties] = Field(
2552
+ None,
2553
+ description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.",
2554
+ title="Query Properties",
2555
+ )
2549
2556
  request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2550
2557
  None,
2551
2558
  description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
@@ -2801,6 +2801,7 @@ class ModelToComponentFactory:
2801
2801
  ).eval(config),
2802
2802
  scopes=model.scopes,
2803
2803
  token_expiry_date_format=model.token_expiry_date_format,
2804
+ token_expiry_is_time_of_expiration=bool(model.token_expiry_date_format),
2804
2805
  message_repository=self._message_repository,
2805
2806
  refresh_token_error_status_codes=model.refresh_token_updater.refresh_token_error_status_codes,
2806
2807
  refresh_token_error_key=model.refresh_token_updater.refresh_token_error_key,
@@ -3220,6 +3221,7 @@ class ModelToComponentFactory:
3220
3221
  hasattr(model.requester, "fetch_properties_from_endpoint")
3221
3222
  and model.requester.fetch_properties_from_endpoint
3222
3223
  ):
3224
+ # todo: Deprecate this condition once dependent connectors migrate to query_properties
3223
3225
  query_properties_definition = QueryPropertiesModel(
3224
3226
  type="QueryProperties",
3225
3227
  property_list=model.requester.fetch_properties_from_endpoint,
@@ -3231,6 +3233,11 @@ class ModelToComponentFactory:
3231
3233
  model=query_properties_definition,
3232
3234
  config=config,
3233
3235
  )
3236
+ elif hasattr(model.requester, "query_properties") and model.requester.query_properties:
3237
+ query_properties = self.create_query_properties(
3238
+ model=model.requester.query_properties,
3239
+ config=config,
3240
+ )
3234
3241
 
3235
3242
  requester = self._create_component_from_model(
3236
3243
  model=model.requester,
@@ -259,7 +259,7 @@ class HttpClient:
259
259
  max_tries = max(0, max_retries) + 1
260
260
  max_time = self._max_time
261
261
 
262
- user_backoff_handler = user_defined_backoff_handler(max_tries=max_tries, max_time=max_time, request_url=request.url)(
262
+ user_backoff_handler = user_defined_backoff_handler(max_tries=max_tries, max_time=max_time)(
263
263
  self._send
264
264
  )
265
265
  rate_limit_backoff_handler = rate_limit_default_backoff_handler(max_tries=max_tries)
@@ -101,7 +101,7 @@ def http_client_default_backoff_handler(
101
101
 
102
102
 
103
103
  def user_defined_backoff_handler(
104
- max_tries: Optional[int], max_time: Optional[int] = None, request_url: Optional[str] = None, **kwargs: Any
104
+ max_tries: Optional[int], max_time: Optional[int] = None, **kwargs: Any
105
105
  ) -> Callable[[SendRequestCallableType], SendRequestCallableType]:
106
106
  def sleep_on_ratelimit(details: Mapping[str, Any]) -> None:
107
107
  _, exc, _ = sys.exc_info()
@@ -111,8 +111,7 @@ def user_defined_backoff_handler(
111
111
  f"Status code: {exc.response.status_code!r}, Response Content: {exc.response.content!r}"
112
112
  )
113
113
  retry_after = exc.backoff
114
- # include logging og the current time to help with debugging
115
- logger.info(f"Retrying. Sleeping for {retry_after} seconds at {time.strftime('%Y-%m-%d %H:%M:%S')} for URL: {request_url or 'unknown'}")
114
+ logger.info(f"Retrying. Sleeping for {retry_after} seconds")
116
115
  time.sleep(retry_after + 1) # extra second to cover any fractions of second
117
116
 
118
117
  def log_give_up(details: Mapping[str, Any]) -> None:
@@ -217,10 +217,26 @@ class AbstractOauth2Authenticator(AuthBase):
217
217
  data=self.build_refresh_request_body(),
218
218
  headers=self.build_refresh_request_headers(),
219
219
  )
220
- # log the response even if the request failed for troubleshooting purposes
220
+
221
+ if not response.ok:
222
+ # log the response even if the request failed for troubleshooting purposes
223
+ self._log_response(response)
224
+ response.raise_for_status()
225
+
226
+ response_json = response.json()
227
+
228
+ try:
229
+ # extract the access token and add to secrets to avoid logging the raw value
230
+ access_key = self._extract_access_token(response_json)
231
+ if access_key:
232
+ add_to_secrets(access_key)
233
+ except ResponseKeysMaxRecurtionReached as e:
234
+ # could not find the access token in the response, so do nothing
235
+ pass
236
+
221
237
  self._log_response(response)
222
- response.raise_for_status()
223
- return response.json()
238
+
239
+ return response_json
224
240
  except requests.exceptions.RequestException as e:
225
241
  if e.response is not None:
226
242
  if e.response.status_code == 429 or e.response.status_code >= 500:
@@ -240,9 +256,7 @@ class AbstractOauth2Authenticator(AuthBase):
240
256
 
241
257
  This method attempts to extract the access token from the provided response data.
242
258
  If the access token is not found, it raises an exception indicating that the token
243
- refresh API response was missing the access token. If the access token is found,
244
- it adds the token to the list of secrets to ensure it is replaced before logging
245
- the response.
259
+ refresh API response was missing the access token.
246
260
 
247
261
  Args:
248
262
  response_data (Mapping[str, Any]): The response data from which to extract the access token.
@@ -257,9 +271,6 @@ class AbstractOauth2Authenticator(AuthBase):
257
271
  raise Exception(
258
272
  f"Token refresh API response was missing access token {self.get_access_token_name()}"
259
273
  )
260
- # Add the access token to the list of secrets so it is replaced before logging the response
261
- # An argument could be made to remove the prevous access key from the list of secrets, but unmasking values seems like a security incident waiting to happen...
262
- add_to_secrets(access_key)
263
274
  except ResponseKeysMaxRecurtionReached as e:
264
275
  raise e
265
276
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.57.3.post2.dev16088474497
3
+ Version: 6.58.0
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -90,7 +90,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=rQz9gXp3
90
90
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
91
91
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=_zGNGq31RNy_0QBLt_EcTvgPyhj7urPdx6oA3M5-r3o,3150
92
92
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
93
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=WI5I5FWDosWpFBfWQ6uwkLTQBujPq-Hn8kW-xZIpZcg,180794
93
+ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=eUESW1yr3OC7izK-NTtpdDxuUP0nNC2-ojxOJBjLpRw,181296
94
94
  airbyte_cdk/sources/declarative/declarative_source.py,sha256=qmyMnnet92eGc3C22yBtpvD5UZjqdhsAafP_zxI5wp8,1814
95
95
  airbyte_cdk/sources/declarative/declarative_stream.py,sha256=dCRlddBUSaJmBNBz1pSO1r2rTw8AP5d2_vlmIeGs2gg,10767
96
96
  airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=JHb_0d3SE6kNY10mxA5YBEKPeSbsWYjByq1gUQxepoE,953
@@ -134,14 +134,14 @@ airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migrati
134
134
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
135
135
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
136
136
  airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py,sha256=Imnj3yef0aqRdLfaUxkIYISUb8YkiPrRH_wBd-x8HjM,5999
137
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=6n2imTLSbP1RVl4G87cEbXsIVvp5lDIFG6zQApf-Vvs,127341
137
+ airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=ViaPosIChoR2z50_gnjFMsqW7ucWKkjxisGdZuy2-qc,127852
138
138
  airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
139
139
  airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=nlVvHC511NUyDEEIRBkoeDTAvLqKNp-hRy8D19z8tdk,5941
140
140
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9Rbu5OexXSDN9QWDo8YU4tT9M2LDVOgGA,802
141
141
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=2UdpCz3yi7ISZTyqkQXSSy3dMxeyOWqV7OlAS5b9GVg,11568
142
142
  airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=EtKjS9c94yNp3AwQC8KUCQaAYW5T3zvFYxoWYjc_buI,19729
143
143
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
144
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=d1GXdgEwolqQSfkMvREvIesUhMgMOMlxoXj4ctPCBwI,176855
144
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=FYnl7J3sBA3AblWxllfn0fN2QRYfuHs2HZOZmiqgt9M,177301
145
145
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
146
146
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
147
147
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -349,10 +349,10 @@ airbyte_cdk/sources/streams/http/error_handlers/json_error_message_parser.py,sha
349
349
  airbyte_cdk/sources/streams/http/error_handlers/response_models.py,sha256=xGIVELBFY0TmH9aUq1ikoqJz8oHLr6di2JLvKWVEO-s,2236
350
350
  airbyte_cdk/sources/streams/http/exceptions.py,sha256=njC7MlMJoFYcSGz4mIp6-bqLFTr6vC8ej25X0oSeyjE,1824
351
351
  airbyte_cdk/sources/streams/http/http.py,sha256=0uariNq8OFnlX7iqOHwBhecxA-Hfd5hSY8_XCEgn3jI,28499
352
- airbyte_cdk/sources/streams/http/http_client.py,sha256=zLt4hAkkm5VyD5aRoZ69DESN-HG6zYmfccIxXzBY8Z0,23036
353
- airbyte_cdk/sources/streams/http/rate_limiting.py,sha256=aAjGpRjbeAYGzUif8lLo7oDL-B2UmlN2UFPcsGtpdw8,6535
352
+ airbyte_cdk/sources/streams/http/http_client.py,sha256=tDE0ROtxjGMVphvsw8INvGMtZ97hIF-v47pZ3jIyiwc,23011
353
+ airbyte_cdk/sources/streams/http/rate_limiting.py,sha256=IwdjrHKUnU97XO4qONgYRv4YYW51xQ8SJm4WLafXDB8,6351
354
354
  airbyte_cdk/sources/streams/http/requests_native_auth/__init__.py,sha256=RN0D3nOX1xLgwEwKWu6pkGy3XqBFzKSNZ8Lf6umU2eY,413
355
- airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py,sha256=2vLa1zMWxIfaj5iLi404Y2YCgC0uDhRCJCvXDwcFBys,19569
355
+ airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py,sha256=0WfnxuxDwRYeq-PIwdUjJujDnxuJPhNfHlX_8aNHtYU,19663
356
356
  airbyte_cdk/sources/streams/http/requests_native_auth/abstract_token.py,sha256=Y3n7J-sk5yGjv_OxtY6Z6k0PEsFZmtIRi-x0KCbaHdA,1010
357
357
  airbyte_cdk/sources/streams/http/requests_native_auth/oauth.py,sha256=gVLo7nU-ORJd413TZHMJQV4m_vaGnRqhoXGGWehFjDA,19253
358
358
  airbyte_cdk/sources/streams/http/requests_native_auth/token.py,sha256=h5PTzcdH-RQLeCg7xZ45w_484OPUDSwNWl_iMJQmZoI,2526
@@ -424,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
424
424
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
425
425
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
426
426
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
427
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/METADATA,sha256=nggEcxpdGIFBdk5Vbn8bs__1S4zJ4joaPgEYbVYvwbY,6498
430
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
- airbyte_cdk-6.57.3.post2.dev16088474497.dist-info/RECORD,,
427
+ airbyte_cdk-6.58.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
+ airbyte_cdk-6.58.0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
+ airbyte_cdk-6.58.0.dist-info/METADATA,sha256=_BmQsFjQ5fxcJ0PPs1LNikv5PHE7ISWfsZGJJfqcLpU,6477
430
+ airbyte_cdk-6.58.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
+ airbyte_cdk-6.58.0.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
+ airbyte_cdk-6.58.0.dist-info/RECORD,,