Skip to content

Commit

Permalink
feat: added extended spend row sync function
Browse files Browse the repository at this point in the history
  • Loading branch information
yehorb committed Nov 1, 2021
1 parent 39e4d2c commit 7ac901f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/tap_apple_search_ads/api/campaign_level_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,16 @@ def sync_extended_spend_row(
end_time: datetime,
selector_name: str,
) -> List[Dict[str, Any]]:
return sync(headers, start_time, end_time, selector_name)
report_rows = sync(headers, start_time, end_time, selector_name)
extended_spend_rows: List[Dict[str, Any]] = []

for row in report_rows:
granularity = row["granularity"]
metadata = row["metadata"]

for granularity_row in granularity:
extended_spend_row = dict(granularity_row)
extended_spend_row["campaignId"] = metadata["campaignId"]
extended_spend_rows.append(extended_spend_row)

return extended_spend_rows

0 comments on commit 7ac901f

Please sign in to comment.