Skip to content
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

Replace deprecated AirbyteLogger with logging.Logger - source-bing-ads #40585

Merged
merged 3 commits into from
Jun 28, 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 @@ -16,7 +16,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 47f25999-dd5e-4636-8c39-e7cea2453331
dockerImageTag: 2.6.4
dockerImageTag: 2.6.5
dockerRepository: airbyte/source-bing-ads
documentationUrl: https://docs.airbyte.com/integrations/sources/bing-ads
githubIssueLabel: source-bing-ads
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 = "2.6.4"
version = "2.6.5"
name = "source-bing-ads"
description = "Source implementation for Bing Ads."
authors = [ "Airbyte <contact@airbyte.io>",]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
import os
import socket
import ssl
Expand All @@ -13,7 +14,6 @@

import backoff
import pendulum
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import FailureType
from airbyte_cdk.utils import AirbyteTracedException
from bingads.authorization import AuthorizationData, OAuthTokens, OAuthWebAuthCodeGrant
Expand All @@ -32,7 +32,7 @@
class Client:
api_version: int = 13
refresh_token_safe_delta: int = 10 # in seconds
logger: AirbyteLogger = AirbyteLogger()
logger: logging.Logger = logging.getLogger("airbyte")
# retry on: rate limit errors, auth token expiration, internal errors
# https://docs.microsoft.com/en-us/advertising/guides/services-protocol?view=bingads-13#throttling
# https://docs.microsoft.com/en-us/advertising/guides/operation-error-codes?view=bingads-13
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
from itertools import product
from typing import Any, List, Mapping, Optional, Tuple

from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import FailureType, SyncMode
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
Expand Down Expand Up @@ -97,7 +97,7 @@ class SourceBingAds(AbstractSource):
Source implementation of Bing Ads API. Fetches advertising data from accounts
"""

def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
def check_connection(self, logger: logging.Logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
try:
client = Client(**config)
accounts = Accounts(client, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ def config_with_custom_reports_fixture():

@pytest.fixture(name="logger_mock")
def logger_mock_fixture():
return patch("source_bing_ads.source.AirbyteLogger")
return patch("source_bing_ads.source.logging.Logger")
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_return_logged_info_for_empty_csv_file(self, http_mocker: HttpMocker):
self.auth_client(http_mocker)
output, _ = self.read_stream(self.stream_name, SyncMode.full_refresh, self._config, "app_install_ad_labels_empty")
assert len(output.records) == 0
assert len(output.logs) == 10
assert len(output.logs) == 11

@HttpMocker()
def test_transform_records(self, http_mocker: HttpMocker):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_return_logged_info_for_empty_csv_file(self, http_mocker: HttpMocker):
self.auth_client(http_mocker)
output, _ = self.read_stream(self.stream_name, SyncMode.full_refresh, self._config, "app_install_ads_empty")
assert len(output.records) == 0
assert len(output.logs) == 10
assert len(output.logs) == 11

@HttpMocker()
def test_transform_records(self, http_mocker: HttpMocker):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_return_logged_info_for_empty_csv_file(self, http_mocker: HttpMocker):
self.auth_client(http_mocker)
output, _ = self.read_stream(self.stream_name, SyncMode.full_refresh, self._config, "budget_empty")
assert len(output.records) == 0
assert len(output.logs) == 10
assert len(output.logs) == 11

@HttpMocker()
def test_transform_records(self, http_mocker: HttpMocker):
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/bing-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ The Bing Ads API limits the number of requests for all Microsoft Advertising cli

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------- |
| 2.6.5 | 2024-06-27 | [40585](https://github.com/airbytehq/airbyte/pull/40585) | Replaced deprecated AirbyteLogger with logging.Logger |
| 2.6.4 | 2024-06-25 | [40457](https://github.com/airbytehq/airbyte/pull/40457) | Update dependencies |
| 2.6.3 | 2024-06-22 | [40006](https://github.com/airbytehq/airbyte/pull/40006) | Update dependencies |
| 2.6.2 | 2024-06-06 | [39177](https://github.com/airbytehq/airbyte/pull/39177) | [autopull] Upgrade base image to v1.2.2 |
Expand Down
Loading