I am facing a existing pricing period data truncation issue when inserting a new pricing period row using DCM API.
NOTE: The github code reference link does not have placement.Patch method usage.
This pricing insert is working fine when using google API explorer. What is the problem with my code?
def create_pricing_period(pricing):
try:
return {
'startDate': pricing['pricingperiodstartdate'],
'endDate': pricing['pricingperiodenddate'],
'units': pricing['units'],
'rateOrCostNanos': int(float(pricing['rateorcostnanos']) * 1e9),
'pricingComment': pricing['pricingcomment']
}
except ValueError as e:
print(f"Error converting rateOrCostNanos: {e}")
return None
Hi Team
I am facing a existing pricing period data truncation issue when inserting a new pricing period row using DCM API.
NOTE: The github code reference link does not have placement.Patch method usage. This pricing insert is working fine when using google API explorer. What is the problem with my code? def create_pricing_period(pricing): try: return { 'startDate': pricing['pricingperiodstartdate'], 'endDate': pricing['pricingperiodenddate'], 'units': pricing['units'], 'rateOrCostNanos': int(float(pricing['rateorcostnanos']) * 1e9), 'pricingComment': pricing['pricingcomment'] } except ValueError as e: print(f"Error converting rateOrCostNanos: {e}") return None
Update body aligned with provided structure