https://linen.dev logo
y

Yiyang (Heap.io)

02/09/2022, 10:12 PM
Hi Team, I am building a custom api connector and running into an error for only one endpoint. I get this error message
Copy code
{"type": "LOG", "log": {"level": "ERROR", "message": "Encountered an exception while reading stream SourceRippling\nTraceback (most recent call last):\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 108, in read\n    internal_config=internal_config,\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 141, in _read_stream\n    for record in record_iterator:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 213, in _read_full_refresh\n    for record in records:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/streams/http/http.py\", line 356, in read_records\n    next_page_token = self.next_page_token(response)\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/source_rippling/streams.py\", line 23, in next_page_token\n    if bool(decoded_response.get(\"has_more\", \"False\")) and decoded_response.get(\"data\", []):\nAttributeError: 'list' object has no attribute 'get'"}}
{"type": "LOG", "log": {"level": "INFO", "message": "Finished syncing SourceRippling"}}
{"type": "LOG", "log": {"level": "INFO", "message": "SourceRippling runtimes:\n"}}
{"type": "LOG", "log": {"level": "FATAL", "message": "'list' object has no attribute 'get'\nTraceback (most recent call last):\n  File \"main.py\", line 13, in <module>\n    launch(source, sys.argv[1:])\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/entrypoint.py\", line 116, in launch\n    for message in source_entrypoint.run(parsed_args):\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/entrypoint.py\", line 107, in run\n    for message in generator:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 112, in read\n    raise e\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 108, in read\n    internal_config=internal_config,\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 141, in _read_stream\n    for record in record_iterator:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 213, in _read_full_refresh\n    for record in records:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/streams/http/http.py\", line 356, in read_records\n    next_page_token = self.next_page_token(response)\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/source_rippling/streams.py\", line 23, in next_page_token\n    if bool(decoded_response.get(\"has_more\", \"False\")) and decoded_response.get(\"data\", []):\nAttributeError: 'list' object has no attribute 'get'"}}
and fatal message that “list” object has no attribute “get”, but this appears right after all the records are read and yielded as output. Another endpoint I made a stream for worked fine without having this fatal message, and the only real difference I could see between the two outputs was that this one was in dictionary format enclosed in curly brackets {}, while the one that was erroring out had a response in list format with [] brackets. To fix this, I tried adding an if case to the parse_response method in the base stream that would yield each row in a for loop if the response type was a list. This gave the same result with all the records yielded, and still getting the fatal list object has not attribute message at the end. Is this a known issue by any chance, or has anyone encountered something similar?
m

Marissa Pagador

02/09/2022, 10:15 PM
decoded_response.get(\"data\", []):\nAttributeError: 'list' object has no attribute 'get'"}}
try
decoded_response.get("data", {})
with this you’ll have a empty dict with the get method instead a empty list.
I still get the same error, just with the {} instead of [] now unfortunately
Copy code
{
  "type": "LOG",
  "log": {
    "level": "FATAL",
    "message": "'list' object has no attribute 'get'\nTraceback (most recent call last):\n  File \"main.py\", line 13, in <module>\n    launch(source, sys.argv[1:])\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/entrypoint.py\", line 116, in launch\n    for message in source_entrypoint.run(parsed_args):\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/entrypoint.py\", line 107, in run\n    for message in generator:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 112, in read\n    raise e\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 108, in read\n    internal_config=internal_config,\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 141, in _read_stream\n    for record in record_iterator:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/abstract_source.py\", line 213, in _read_full_refresh\n    for record in records:\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/.venv/lib/python3.7/site-packages/airbyte_cdk/sources/streams/http/http.py\", line 356, in read_records\n    next_page_token = self.next_page_token(response)\n  File \"/Users/marissa/github/airbyte/airbyte-integrations/connectors/source-rippling/source_rippling/streams.py\", line 23, in next_page_token\n    if bool(decoded_response.get(\"has_more\", \"False\")) and decoded_response.get(\"data\", {}):\nAttributeError: 'list' object has no attribute 'get'"
  }
}
2 Views