BingAds / BingAds-Python-SDK

Other
117 stars 162 forks source link

Issue after Upgrade to v11.12.4 #95

Closed nmylarappa closed 6 years ago

nmylarappa commented 6 years ago

Hi,

We are seeing this below issue after we upgraded the SDK to 11.12.14.

from bingads.v11.bulk import File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/init.py", line 11, in from .file_reader import File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/file_reader.py", line 2, in from .entities.bulk_entity import BulkEntity File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/entities/init.py", line 4, in from .common import File "/usr/local/lib/python2.7/dist-packages/bingads/v11/bulk/entities/common.py", line 1, in from bingads.v11.internal.bulk.string_table import _StringTable File "/usr/local/lib/python2.7/dist-packages/bingads/v11/internal/init.py", line 4, in from .extensions import File "/usr/local/lib/python2.7/dist-packages/bingads/v11/internal/extensions.py", line 42, in TargetSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V11.create('TargetSetting')) File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 218, in create raise TypeNotFound(name) suds.TypeNotFound: Type not found: 'TargetSetting''''

qitia commented 6 years ago

I did not reproduce this issue. Could you please confirm there is nothing env change but just upgrade this SDK to 11.12.4? does it work with 11.12.3?

nmylarappa commented 6 years ago

Hello,

I am seeing the below issue after pointing it to api version 12.

DEBUG:suds.client:sending to (https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V12/ReportingService.svc) message: <?xml version="1.0" encoding="UTF-8"?>

115I3QYKX8699642 Csv English false Daily AccountNumber AccountName AccountId CurrencyCode CampaignId CampaignName CampaignStatus KeywordId Keyword KeywordStatus TimePeriod DeviceType BidMatchType AveragePosition Spend Clicks Conversions Impressions AdGroupId AdGroupName AdGroupStatus AdDistribution Network 47091023 11 09 2018 06 09 2018 DEBUG:suds.client:headers = {'SOAPAction': '"SubmitGenerateReport"', 'Content-Type': 'text/xml; charset=utf-8', 'User-Agent': 'BingAdsSDKPython 11.12.4 (2, 7, 6)'} DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: a:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v12:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimeZone'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details. ERROR:suds.client: Traceback (most recent call last): File "/home/nmylarappa/dwh/Scripts/mktg_bing_keyword_perf_f/pythonscripts/bing_download.py", line 442, in output_webfault_errors(ex) File "/home/nmylarappa/dwh/Scripts/mktg_bing_keyword_perf_f/pythonscripts/bing_download.py", line 216, in output_webfault_errors raise Exception('Unknown WebFault') Exception: Unknown WebFault
qitia commented 6 years ago

Thanks @nmylarappa seems you are reporting two different issues? May I know if you still repro the 'TargetSetting' issue with V11?

For the second Download Reporting issue, though it is 'nillabe'(reference), missing of request.Time.ReportTimeZone will cause this issue, this should be a SUDS limitation. Currently you have two ways to work around this:

1, set a valid timezone for this parameter - FYI the valid timezone is listed here, for e.g. submit_request.Time.ReportTimeZone = 'CentralAmerica' more examples here. Or if you do not know which should be used

2, try add this line before submitting the request submit_request = self.reporting_service.factory.create('KeywordPerformanceReportRequest') delattr(submit_request.Time, "ReportTimeZone") ...

Let me know.

harry1180 commented 6 years ago

Thanks @qitia a lot this solved our issue. but we have this same issue for campaign performance end point too. we deleted ReportTimeZone attribute but it is not working. Do we have to delete any other attributes ? are we missing something else ?

sample log :

=== Start downloading CampaignPerformanceReport_B017WYJL.csv === No handlers could be found for logger "suds.client" Traceback (most recent call last): File "/home/hkoppuravuri/dwh/Scripts/mktg_bing_campaign_perf_f/pythonscripts/bing_download.py", line 440, in output_webfault_errors(ex) File "/home/hkoppuravuri/dwh/Scripts/mktg_bing_campaign_perf_f/pythonscripts/bing_download.py", line 217, in output_webfault_errors raise Exception('Unknown WebFault') Exception: Unknown WebFault

qitia commented 6 years ago

@harry1180 do you have the soap request and response?

harry1180 commented 6 years ago

Yes I have (I and @nmylarappa belong to same team btw)

harry1180 commented 6 years ago

I tried deleting all columns with None value. "delattr(report_request.Time, "ReportTimeZone") delattr(report_request.Time, "PredefinedTime") delattr(report_request.Filter, "AccountStatus") delattr(report_request.Filter, "AdDistribution") delattr(report_request.Filter, "DeviceOS") delattr(report_request.Filter, "DeviceType") delattr(report_request.Filter, "Status") delattr(report_request.Scope, "AdGroups") delattr(report_request.Scope, "Campaigns") but still it did not work

harry1180 commented 6 years ago

may be this long can help u understand issue more in detail === Start downloading CampaignPerformanceReport_B017WYJL.csv === DEBUG:suds.client:sending to (https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V12/ReportingService.svc) message: <?xml version="1.0" encoding="UTF-8"?>

XXXXX XXXXXXXX XXXXX XXXXX Csv English false Daily AccountId AccountName AccountNumber CampaignId CampaignName Status TimePeriod DeviceType CurrencyCode Spend Impressions Clicks AverageCpc AverageCpp AveragePosition Ctr Conversions Network AdDistribution QualityScore Revenue RevenuePerAssist ReturnOnAdSpend RevenuePerConversion CostPerAssist CostPerConversion ConversionRate XXXXXXXX DEBUG:suds.client:headers = {'SOAPAction': '"SubmitGenerateReport"', 'Content-Type': 'text/xml; charset=utf-8', 'User-Agent': 'BingAdsSDKPython 11.12.4 (2, 7, 6)'} DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: a:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v12:ReportRequest. The InnerException message was 'Invalid enum value 'Status' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.CampaignPerformanceReportColumn'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details. ERROR:suds.client: Traceback (most recent call last): File "/home/hkoppuravuri/dwh/Scripts/mktg_bing_campaign_perf_f/pythonscripts/bing_download.py", line 448, in output_webfault_errors(ex) File "/home/hkoppuravuri/dwh/Scripts/mktg_bing_campaign_perf_f/pythonscripts/bing_download.py", line 216, in output_webfault_errors raise Exception('Unknown WebFault') Exception: Unknown WebFault
qitia commented 6 years ago

@nmylarappa @harry1180 Are you switching from V11 to V12? Please notice that there are some breaking changes when we upgrade to v12. For example the column names for CampaignPerformanceReport are not exactly same. Please see v11 and v12 for reference. I think for v12, it should be CampaignStatus what you want.

qitia commented 6 years ago

@nmylarappa @harry1180 I suppose your issue has been resolved. I close this issue and you can re-open it in case more concern.

harry1180 commented 6 years ago

Hi @qitia ,

Thanks for helping us in our earlier issue. We are in need of some info so thought of posting it in here.

we are facing an issue with the reporting data related to four campaigns in particular for our camapign section end point. There is this column called Addistribution which should have 'Search' or 'Content' or 'Native' but we are getting a new value named 'Audience'. This cannot be an appropriate value for ad distribution as far as we understand. We have this value only for the recent records and that too after version upgrade. Can you confirm on this once pls?

we are noticing this value for four of our campaigns. Happy to have a session to discuss on this. If it is a valid value we need to change our ETL logic to facilitate the same. Kindly confirm on the same.