Skip to content

Commit

Permalink
implemented bingads v12 changes and output Webfault exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolland82 committed Feb 22, 2019
1 parent 5d2f149 commit bbc4a5b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bingads_downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import urllib
import webbrowser
from pathlib import Path
from suds import WebFault

from bingads import (AuthorizationData, OAuthAuthorization, OAuthDesktopMobileAuthCodeGrant,
OAuthTokenRequestException)
from bingads.service_client import ServiceClient
from bingads.v11.reporting.reporting_service_manager import ReportingServiceManager, time
from bingads.v12.reporting.reporting_service_manager import ReportingServiceManager, time

from bingads_downloader import config

Expand All @@ -34,15 +35,19 @@ def __init__(self):

self.client = super(BingReportClient, self).__init__(service='ReportingService',
authorization_data=authorization_data,
environment='production', version='v11')
environment='production', version='v12')


def download_data():
"""
Creates an BingApiClient and downloads the data
"""
api_client = BingReportClient()
download_data_sets(api_client)
try:
api_client = BingReportClient()
download_data_sets(api_client)
except WebFault as e:
print(e.fault)
raise


def download_data_sets(api_client: BingReportClient):
Expand Down Expand Up @@ -292,6 +297,7 @@ def set_report_time(api_client: BingReportClient,
custom_date_range_start.Year = first_date.year
report_time.CustomDateRangeStart = custom_date_range_start
report_time.PredefinedTime = None
report_time.ReportTimeZone = None

return report_time

Expand Down

0 comments on commit bbc4a5b

Please sign in to comment.