Hello. I am running into an issue with the `airbyt...
# airbyte-api
j
Hello. I am running into an issue with the
airbyte-api-python-sdk
package. I am trying to list all available sources in my workspace. I am using the example shown in the docs. My code is:
Copy code
import airbyte
from airbyte.models import operations
from airbyte.models import shared

s = airbyte.Airbyte(
    security=shared.Security(
        bearer_auth="Bearer xxxx",
    ),
)

req = operations.ListSourcesRequest(
    include_deleted=False,
    workspace_ids=[
        WORKSPACE_ID,
    ],
)
res = s.sources.list_sources(req)
The code is returning the following error:
Copy code
Traceback (most recent call last):
  File "/.../airybte_meta_source.py", line 21, in <module>
    res = s.sources.list_sources(req)
  File "/.../venv/lib/python3.9/site-packages/airbyte/sources.py", line 152, in list_sources
    out = utils.unmarshal_json(http_res.text, Optional[shared.SourcesResponse])
  File "/.../venv/lib/python3.9/site-packages/airbyte/utils/utils.py", line 681, in unmarshal_json
    out = unmarhsal.from_dict({"res": json_dict})
  File "/...venv/lib/python3.9/site-packages/dataclasses_json/api.py", line 72, in from_dict
    return _decode_dataclass(cls, kvs, infer_missing)
  File "/...venv/lib/python3.9/site-packages/dataclasses_json/core.py", line 206, in _decode_dataclass
    init_kwargs[field.name] = _decode_generic(field_type,
  File "/...venv/lib/python3.9/site-packages/dataclasses_json/core.py", line 282, in _decode_generic
    res = _decode_dataclass(type_arg, value, infer_missing)
  File "/...venv/lib/python3.9/site-packages/dataclasses_json/core.py", line 163, in _decode_dataclass
    field_value = kvs[field.name]
KeyError: 'next'
It looks like the actual response does not match the expected response. As per the API docs, the response should contain the following keys:`['data', 'next', 'previous']` . However, the API is only returning the
data
key. Can someone reproduce this error or am I missing something on my request?
j
@Jan Nitschke you're correct here, those fields are marked as required, but we actually only generate the next and previous fields when there are actual pages to go to. I'll work on getting a fix out for that and updating the python SDK.
j
great, thanks keanu thanks
j
@Jan Nitschke Update has been published to pypi - can you please try again and let me know if you run into any issues?
j
works perfectly, thanks 🙂