airbyte-cdk 6.18.0.dev0__py3-none-any.whl → 6.18.0.dev1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py +16 -18
- {airbyte_cdk-6.18.0.dev0.dist-info → airbyte_cdk-6.18.0.dev1.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.18.0.dev0.dist-info → airbyte_cdk-6.18.0.dev1.dist-info}/RECORD +6 -6
- {airbyte_cdk-6.18.0.dev0.dist-info → airbyte_cdk-6.18.0.dev1.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.18.0.dev0.dist-info → airbyte_cdk-6.18.0.dev1.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.18.0.dev0.dist-info → airbyte_cdk-6.18.0.dev1.dist-info}/entry_points.txt +0 -0
@@ -7,6 +7,7 @@ from dataclasses import dataclass
|
|
7
7
|
from io import BufferedIOBase, TextIOWrapper
|
8
8
|
from typing import Any, Generator, MutableMapping, Optional
|
9
9
|
|
10
|
+
import orjson
|
10
11
|
import requests
|
11
12
|
|
12
13
|
from airbyte_cdk.models import FailureType
|
@@ -46,30 +47,27 @@ class GzipParser(Parser):
|
|
46
47
|
|
47
48
|
@dataclass
|
48
49
|
class JsonParser(Parser):
|
49
|
-
"""
|
50
|
-
Parser strategy for converting JSON-structure str, bytes, or bytearray data into MutableMapping[str, Any].
|
51
|
-
"""
|
52
|
-
|
53
50
|
encoding: str = "utf-8"
|
54
51
|
|
55
52
|
def parse(self, data: BufferedIOBase) -> Generator[MutableMapping[str, Any], None, None]:
|
56
53
|
raw_data = data.read()
|
57
54
|
try:
|
58
|
-
body_json =
|
59
|
-
except
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
else:
|
55
|
+
body_json = orjson.loads(raw_data.decode(self.encoding))
|
56
|
+
except Exception:
|
57
|
+
try:
|
58
|
+
body_json = json.loads(raw_data.decode(self.encoding))
|
59
|
+
except Exception as exc:
|
60
|
+
raise AirbyteTracedException(
|
61
|
+
message="Response JSON data failed to be parsed. See logs for more inforation.",
|
62
|
+
internal_message=f"Response JSON data faild to be parsed: {exc=}, {raw_data=}",
|
63
|
+
failure_type=FailureType.system_error,
|
64
|
+
exception=exc,
|
65
|
+
)
|
66
|
+
|
67
|
+
if isinstance(body_json, list):
|
72
68
|
yield from body_json
|
69
|
+
else:
|
70
|
+
yield from [body_json]
|
73
71
|
|
74
72
|
|
75
73
|
@dataclass
|
@@ -70,7 +70,7 @@ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=QDqDyKm
|
|
70
70
|
airbyte_cdk/sources/declarative/declarative_source.py,sha256=nF7wBqFd3AQmEKAm4CnIo29CJoQL562cJGSCeL8U8bA,1531
|
71
71
|
airbyte_cdk/sources/declarative/declarative_stream.py,sha256=JRyNeOIpsFu4ztVZsN6sncqUEIqIE-bUkD2TPgbMgk0,10375
|
72
72
|
airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=edGj4fGxznBk4xzRQyCA1rGfbpqe7z-RE0K3kQQWbgA,858
|
73
|
-
airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py,sha256=
|
73
|
+
airbyte_cdk/sources/declarative/decoders/composite_raw_decoder.py,sha256=rSvqdGsVgBT3ZfY_bthjZl_OmxY84iKz8g9GQIWyq8k,3766
|
74
74
|
airbyte_cdk/sources/declarative/decoders/decoder.py,sha256=sl-Gt8lXi7yD2Q-sD8je5QS2PbgrgsYjxRLWsay7DMc,826
|
75
75
|
airbyte_cdk/sources/declarative/decoders/json_decoder.py,sha256=qdbjeR6RffKaah_iWvMsOcDolYuxJY5DaI3b9AMTZXg,3327
|
76
76
|
airbyte_cdk/sources/declarative/decoders/noop_decoder.py,sha256=iZh0yKY_JzgBnJWiubEusf5c0o6Khd-8EWFWT-8EgFo,542
|
@@ -342,8 +342,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
|
|
342
342
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
343
343
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
344
344
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
345
|
-
airbyte_cdk-6.18.0.
|
346
|
-
airbyte_cdk-6.18.0.
|
347
|
-
airbyte_cdk-6.18.0.
|
348
|
-
airbyte_cdk-6.18.0.
|
349
|
-
airbyte_cdk-6.18.0.
|
345
|
+
airbyte_cdk-6.18.0.dev1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
346
|
+
airbyte_cdk-6.18.0.dev1.dist-info/METADATA,sha256=ALXOgvI3pTcF2tNmvbQ9S8fG424n229th_tx1u2uSCo,6005
|
347
|
+
airbyte_cdk-6.18.0.dev1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
348
|
+
airbyte_cdk-6.18.0.dev1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
349
|
+
airbyte_cdk-6.18.0.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|