Skip to content

Source Google Analytics v4: fix empty response error #37432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 9e28a926-8f3c-4911-982d-a2e1c378b59c
dockerImageTag: 0.0.1
dockerImageTag: 0.0.2
dockerRepository: airbyte/source-google-analytics-v4-service-account-only
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4-service-account-only
githubIssueLabel: source-google-analytics-v4-service-account-only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: eff3616a-f9c3-11eb-9a03-0242ac130003
dockerImageTag: 0.3.0
dockerImageTag: 0.3.1
dockerRepository: airbyte/source-google-analytics-v4
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4
githubIssueLabel: source-google-analytics-v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.3.0"
version = "0.3.1"
name = "source-google-analytics-v4"
description = "Source implementation for Google Analytics V4."
authors = [ "Airbyte <[email protected]>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ def get_refresh_request_params(self) -> Mapping[str, Any]:
class TestStreamConnection(GoogleAnalyticsV4Stream):
"""
Test the connectivity and permissions to read the data from the stream.
Because of the nature of the connector, the streams are created dynamicaly.
We declare the static stream like this to be able to test out the prmissions to read the particular view_id."""
Because of the nature of the connector, the streams are created dynamically.
We declare the static stream like this to be able to test out the permissions to read the particular view_id."""

page_size = 1

Expand All @@ -552,7 +552,11 @@ def stream_slices(self, stream_state: Mapping[str, Any] = None, **kwargs: Any) -

def parse_response(self, response: requests.Response, **kwargs: Any) -> Iterable[Mapping]:
res = response.json()
return res.get("reports", {})[0].get("data")
try:
return res.get("reports", [])[0].get("data")
except IndexError:
self.logger.warning(f"No reports in response: {res}")
return []


class SourceGoogleAnalyticsV4(AbstractSource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ The Google Analytics connector should not run into the "requests per 100 seconds

## Changelog

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:----------------------------------------------------------|:----------------|
| 0.0.1 | 2023-01-22 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Initial Release |
| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:-----------------------------------------|
| 0.0.2 | 2024-04-19 | [37432](https://github.com/airbytehq/airbyte/pull/36267) | Fix empty response error for test stream |
| 0.0.1 | 2024-01-29 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Initial Release |

</HideInUI>
5 changes: 3 additions & 2 deletions docs/integrations/sources/google-analytics-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ The Google Analytics connector should not run into the "requests per 100 seconds
## Changelog

| Version | Date | Pull Request | Subject |
|:--------| :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------------- |
| 0.3.0 | 2024-03-19 | [36267](https://github.com/airbytehq/airbyte/pull/36267) | Pin airbyte-cdk version to `^0` |
|:--------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------------|
| 0.3.1 | 2024-04-19 | [37432](https://github.com/airbytehq/airbyte/pull/36267) | Fix empty response error for test stream |
| 0.3.0 | 2024-03-19 | [36267](https://github.com/airbytehq/airbyte/pull/36267) | Pin airbyte-cdk version to `^0` |
| 0.2.5 | 2024-02-09 | [35101](https://github.com/airbytehq/airbyte/pull/35101) | Manage dependencies with Poetry. |
| 0.2.4 | 2024-01-22 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Update setup dependencies |
| 0.2.3 | 2024-01-18 | [34353](https://github.com/airbytehq/airbyte/pull/34353) | Add End date option |
Expand Down
Loading