Skip to content

Commit

Permalink
chore: update google ads to use version v17
Browse files Browse the repository at this point in the history
  • Loading branch information
am6010 committed Sep 25, 2024
1 parent 8631655 commit b0d3245
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-google-ads/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# pin protobuf==3.20.0 as other versions may cause problems on different architectures
# (see https://github.com/airbytehq/airbyte/issues/13580)
MAIN_REQUIREMENTS = ["airbyte-cdk==0.67", "google-ads==22.1.0", "protobuf", "pendulum"]
MAIN_REQUIREMENTS = ["airbyte-cdk==0.67", "google-ads==25.0.0", "protobuf", "pendulum"]

TEST_REQUIREMENTS = ["pytest~=6.1", "pytest-mock", "freezegun", "requests-mock"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from airbyte_cdk.models import FailureType
from airbyte_cdk.utils import AirbyteTracedException
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.v15.services.types.google_ads_service import GoogleAdsRow, SearchGoogleAdsResponse
from google.ads.googleads.v17.services.types.google_ads_service import GoogleAdsRow, SearchGoogleAdsResponse
from google.api_core.exceptions import ServerError, TooManyRequests
from google.auth import exceptions
from proto.marshal.collections import Repeated, RepeatedComposite
Expand All @@ -36,12 +36,11 @@
"geographic_report": "geographic_view",
"keyword_report": "keyword_view",
}
API_VERSION = "v15"
API_VERSION = "v17"
logger = logging.getLogger("airbyte")


class GoogleAds:
DEFAULT_PAGE_SIZE = 1000

def __init__(self, credentials: MutableMapping[str, Any]):
# `google-ads` library version `14.0.0` and higher requires an additional required parameter `use_proto_plus`.
Expand Down Expand Up @@ -70,7 +69,6 @@ def send_request(self, query: str, customer_id: str) -> Iterator[SearchGoogleAds
client = self.client
search_request = client.get_type("SearchGoogleAdsRequest")
search_request.query = query
search_request.page_size = self.DEFAULT_PAGE_SIZE
search_request.customer_id = customer_id
return [self.ga_service.search(search_request)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.utils import AirbyteTracedException
from google.ads.googleads.errors import GoogleAdsException
from google.ads.googleads.v15.errors.types.authorization_error import AuthorizationErrorEnum
from google.ads.googleads.v17.errors.types.authorization_error import AuthorizationErrorEnum
from pendulum import parse, today

from .custom_query_stream import CustomQuery, IncrementalCustomQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from airbyte_cdk.sources.streams import IncrementalMixin, Stream
from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer
from google.ads.googleads.errors import GoogleAdsException
from google.ads.googleads.v15.errors.types.authorization_error import AuthorizationErrorEnum
from google.ads.googleads.v15.errors.types.request_error import RequestErrorEnum
from google.ads.googleads.v15.services.services.google_ads_service.pagers import SearchPager
from google.ads.googleads.v17.errors.types.authorization_error import AuthorizationErrorEnum
from google.ads.googleads.v17.errors.types.request_error import RequestErrorEnum
from google.ads.googleads.v17.services.services.google_ads_service.pagers import SearchPager

from .google_ads import GoogleAds
from .models import Customer
Expand Down

0 comments on commit b0d3245

Please sign in to comment.