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

fix: upgrade to v13 #196

Merged
merged 1 commit into from
Mar 20, 2023
Merged
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
19 changes: 11 additions & 8 deletions hip_data_tools/google/googleads.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,17 @@ def _refine_result_list(
number_of_workers: int, page_size: int, result: list, total_entries: int
) -> None:
last_page_size = total_entries % page_size
number_of_workers_with_non_zero_pages = math.ceil(total_entries / page_size)
number_of_workers_with_non_zero_pages = math.ceil(
total_entries / page_size)
for workers_with_non_zero_pages in range(number_of_workers_with_non_zero_pages):
result[workers_with_non_zero_pages]["number_of_pages"] = 1
result[workers_with_non_zero_pages]["page_size"] = page_size
for worker_with_zero_pages in range(
number_of_workers_with_non_zero_pages, number_of_workers
):
result[worker_with_zero_pages]["start_index"] = 0
result[number_of_workers_with_non_zero_pages - 1]["page_size"] = last_page_size
result[number_of_workers_with_non_zero_pages -
1]["page_size"] = last_page_size


def _refine_page_confings(
Expand Down Expand Up @@ -362,7 +364,8 @@ def get_parallel_payloads(
result[0]["number_of_pages"] = 1
result[0]["page_size"] = total_entries
elif page_size * number_of_workers > total_entries:
_refine_result_list(number_of_workers, page_size, result, total_entries)
_refine_result_list(number_of_workers,
page_size, result, total_entries)
return result

def _get_total_entries(self) -> int:
Expand All @@ -383,7 +386,7 @@ class GoogleAdsCustomerUtil(AdWordsDataReader):
"""

def __init__(self, conn: GoogleAdsConnectionManager):
super().__init__(conn, service="CustomerService", version="v10")
super().__init__(conn, service="CustomerService", version="v13")

def get_customers(self) -> List[dict]:
"""
Expand Down Expand Up @@ -413,7 +416,7 @@ class GoogleAdsClicksConversionUtil(GoogleAdsUtil):
"""

def __init__(self, conn: GoogleAdsConnectionManager):
super().__init__(conn, type="ClickConversion", version="v10")
super().__init__(conn, type="ClickConversion", version="v13")

def click_conversion(self, data):
"""
Expand Down Expand Up @@ -442,7 +445,7 @@ class GoogleAdsUploadClickConversionsRequestUtil(GoogleAdsUtil):
"""

def __init__(self, conn: GoogleAdsConnectionManager):
super().__init__(conn, type="UploadClickConversionsRequest", version="v10")
super().__init__(conn, type="UploadClickConversionsRequest", version="v13")

def upload_click_conversion(self, customer_id: str, click_conversion):
"""
Expand All @@ -467,7 +470,7 @@ class GoogleAdsConversionActionUtil(GoogleAdsUtil):
"""

def __init__(self, conn: GoogleAdsConnectionManager):
super().__init__(conn, service="ConversionActionService", version="v10")
super().__init__(conn, service="ConversionActionService", version="v13")

def get_conversion_action(self, customer_id: str, conversion_action_id: str):
"""
Expand All @@ -489,7 +492,7 @@ class GoogleAdsOfflineConversionUtil(GoogleAdsUtil):
"""

def __init__(self, conn: GoogleAdsConnectionManager):
super().__init__(conn, service="ConversionUploadService", version="v10")
super().__init__(conn, service="ConversionUploadService", version="v13")
self.required_fields = [
"gclid",
"conversion_action",
Expand Down