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

Update to api v13 #37

Merged
merged 3 commits into from
Jan 13, 2020
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 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
py_modules=['tap_bingads'],
install_requires=[
'arrow==0.12.0',
'bingads==11.12.6',
'bingads==12.13.1',
'requests==2.20.0',
'singer-python==5.9.0',
'stringcase==1.2.0',
Expand Down
13 changes: 9 additions & 4 deletions tap_bing_ads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def wrapper(*args, **kwargs):

class CustomServiceClient(ServiceClient):
def __init__(self, name, **kwargs):
return super().__init__(name, 'v12', **kwargs)
return super().__init__(name, 'v13', **kwargs)

def __getattr__(self, name):
service_method = super(CustomServiceClient, self).__getattr__(name)
Expand Down Expand Up @@ -609,9 +609,15 @@ def type_report_row(row):
if value is not None and field_name in reports.REPORTING_FIELD_TYPES:
_type = reports.REPORTING_FIELD_TYPES[field_name]
if _type == 'integer':
value = int(value.replace(',', ''))
if value == '--':
value = 0
else:
value = int(value.replace(',', ''))
elif _type == 'number':
value = float(value.replace('%', '').replace(',', ''))
if value == '--':
value = 0.0
else:
value = float(value.replace('%', '').replace(',', ''))
elif _type in ['date', 'datetime']:
value = arrow.get(value).isoformat()

Expand Down Expand Up @@ -826,7 +832,6 @@ def build_report_request(client, account_id, report_stream, report_name,
report_request = client.factory.create('{}Request'.format(report_name))
report_request.Format = 'Csv'
report_request.Aggregation = 'Daily'
report_request.Language = 'English'
report_request.ExcludeReportHeader = True
report_request.ExcludeReportFooter = True

Expand Down
2 changes: 1 addition & 1 deletion tap_bing_ads/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'AdPerformanceReport',
'AdGroupPerformanceReport',
'GeographicPerformanceReport',
'AgeGenderDemographicReport',
'AgeGenderAudienceReport',
'SearchQueryPerformanceReport',
'CampaignPerformanceReport',
'GoalsAndFunnelsReport',
Expand Down