BingAds / BingAds-Python-SDK

Other
115 stars 162 forks source link

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v13:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimePeriod'. 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.' #258

Open priyansh-think360 opened 8 months ago

priyansh-think360 commented 8 months ago

I am trying to fetch four reports namely: 1) Ads performance report 2) AdGroup performance report 3) Campaign performance report 4) Keyword performance report

It is able to successfully fetch the first three, but while fetching the Keyword performance report it gives the following error:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/Reporting/v13:ReportRequest. The InnerException message was 'Invalid enum value '' cannot be deserialized into type 'Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Enum.ReportTimePeriod'. 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.'

Here is the snippet of the way i defined Time: aggregation = 'Daily' exclude_column_headers=False exclude_report_footer=False exclude_report_header=False return_only_complete_data=False

time=reporting_service.factory.create('ReportTime')

time.ReportTimeZone='EasternTimeUSCanada'
time.CustomDateRangeStart.Day = start_time.day   
time.CustomDateRangeStart.Month = start_time.month 
time.CustomDateRangeStart.Year = start_time.year  
time.CustomDateRangeEnd.Day = date.today().day - 1
time.CustomDateRangeEnd.Month = date.today().month
time.CustomDateRangeEnd.Year = date.today().year

if i also give time.PredefinedTime = None, then the code runs but the keyword performance report comes out as null

qitia commented 8 months ago

can you share the trackingid/requestid? And, can you please try below as example shows: time=set_elements_to_none(reporting_service.factory.create('ReportTime'))