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

chore: update google ads to use version v17 #203

Merged
merged 1 commit into from
Sep 25, 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
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
am6010 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading