Issue with airbyte-python-sdk: KeyError when creat...
# airbyte-api
k
Issue with airbyte-python-sdk: KeyError when creating a new workspace Hi Airbyte team, First of all, thank you for creating such an amazing library! I've encountered an issue when trying to create a new workspace using airbyte-python-sdk. The error occurs in a Linux VM environment, but I've been able to reproduce it in Google Colab as well. Here's a minimal example to reproduce the issue
Copy code
!pip install airbyte-api==0.7.0

import airbyte
from airbyte.models import operations, shared

s=airbyte.Airbyte(
    security=shared.Security(
        bearer_auth="<TOKEN>"
    )
  )
req = shared.WorkspaceCreateRequest(name="example")
print(req.to_json()) # {"name": "example"}
t=s.workspaces.create_workspace(req) # ERROR HERE
Stack trace is attached to this thread. Thank you for your help !
Copy code
KeyError                                  Traceback (most recent call last)
<ipython-input-7-d63307e394b4> in <cell line: 11>()
      9 req = shared.WorkspaceCreateRequest(name="example")
     10 print(req.to_json())
---> 11 t=s.workspaces.create_workspace(req)
     12 l = s.workspaces.list_workspaces(operations.ListWorkspacesRequest())
     13 
/usr/local/lib/python3.10/dist-packages/airbyte/workspaces.py
 in create_workspace(self, request)
     74         if http_res.status_code == 200:
     75             if utils.match_content_type(content_type, 'application/json'):
---> 76                 out = utils.unmarshal_json(http_res.text, Optional[shared.WorkspaceResponse])
     77                 res.workspace_response = out
     78         elif http_res.status_code in [400, 403]:

/usr/local/lib/python3.10/dist-packages/airbyte/utils/utils.py in unmarshal_json(data, typ)
    679                                bases=(DataClassJsonMixin,))
    680     json_dict = json.loads(data)
--> 681     out = unmarhsal.from_dict({"res": json_dict})
    682     return out.res
    683 

/usr/local/lib/python3.10/dist-packages/dataclasses_json/api.py in from_dict(cls, kvs, infer_missing)
     70                   *,
     71                   infer_missing=False) -> A:
---> 72         return _decode_dataclass(cls, kvs, infer_missing)
     73 
     74     def to_dict(self, encode_json=False) -> Dict[str, Json]:

/usr/local/lib/python3.10/dist-packages/dataclasses_json/core.py in _decode_dataclass(cls, kvs, infer_missing)
    204             init_kwargs[field.name] = value
    205         elif _is_supported_generic(field_type) and field_type != str:
--> 206             init_kwargs[field.name] = _decode_generic(field_type,
    207                                                       field_value,
    208                                                       infer_missing)

/usr/local/lib/python3.10/dist-packages/dataclasses_json/core.py in _decode_generic(type_, value, infer_missing)
    280             type_arg = _get_type_arg_param(type_, 0)
    281             if is_dataclass(type_arg) or is_dataclass(value):
--> 282                 res = _decode_dataclass(type_arg, value, infer_missing)
    283             elif _is_supported_generic(type_arg):
    284                 res = _decode_generic(type_arg, value, infer_missing)

/usr/local/lib/python3.10/dist-packages/dataclasses_json/core.py in _decode_dataclass(cls, kvs, infer_missing)
    161             continue
    162 
--> 163         field_value = kvs[field.name]
    164         field_type = types[field.name]
    165         if field_value is None:
KeyError: 'name'