def remove_budget(budget_service, budget_id):
'''function to remove budget
we need this because there is a limitation on a number of the budget instances
we are allowed to create'''
# Construct operations to remove budget.
budget = {
'budgetId': budget_id,
'status': 'REMOVED'
}
operations = [{
'operator': 'SET',
'operand': budget
}]
budgets = budget_service.mutate(operations)
return budgets
# Here goes SOAP XML:
[2020-03-05 20:03:01,764 - googleads.soap - INFO] Request made: Service: "BudgetService" Method: "mutate" URL: "https://adwords.google.com/api/adwords/cm/v201809/BudgetService"
[2020-03-05 20:03:01,766 - googleads.soap - DEBUG] Outgoing request: {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'authorization': 'REDACTED'}
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">
<ns0:clientCustomerId> ANONYMYZED </ns0:clientCustomerId>
<ns0:developerToken>REDACTED</ns0:developerToken>
<ns0:userAgent>Zavient (AwApi-Python, googleads/22.0.0, Python/3.7.3, zeep)</ns0:userAgent>
<ns0:validateOnly>false</ns0:validateOnly>
<ns0:partialFailure>false</ns0:partialFailure>
</ns0:RequestHeader>
</soap-env:Header>
<soap-env:Body>
<ns0:mutate xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">
<ns0:operations>
<ns0:operator>SET</ns0:operator>
<ns0:operand>
<ns0:budgetId>ANONYMYZED</ns0:budgetId>
<ns0:status>REMOVED</ns0:status>
</ns0:operand>
</ns0:operations>
</ns0:mutate>
</soap-env:Body>
</soap-env:Envelope>
[2020-03-05 20:03:04,074 - googleads.soap - DEBUG] Incoming response:
b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\n <soap:Header>\n <requestId> ANONYMYZED </requestId>\n
<serviceName>BudgetService</serviceName>\n <methodName>mutate</methodName>\n
<operations>1</operations>\n <responseTime>218</responseTime>\n
</ResponseHeader>\n </soap:Header>\n <soap:Body>\n
<rval>\n <ListReturnValue.Type>BudgetReturnValue</ListReturnValue.Type>\n <value>\n
<budgetId> ANONYMYZED </budgetId>\n
<name> ANONYMYZED </name>\n
<amount>\n <ComparableValue.Type>Money</ComparableValue.Type>\n <microAmount>1100000</microAmount>\n </amount>\n
<deliveryMethod>STANDARD</deliveryMethod>\n
<isExplicitlyShared>false</isExplicitlyShared>\n
<status>ENABLED</status>\n </value>\n </rval>\n </mutateResponse>\n </soap:Body>\n</soap:Envelope>\n'