Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在新的谷歌广告python库中更新活动预算?_Python_Ads_Google Ads Api - Fatal编程技术网

如何在新的谷歌广告python库中更新活动预算?

如何在新的谷歌广告python库中更新活动预算?,python,ads,google-ads-api,Python,Ads,Google Ads Api,我正在使用谷歌广告python获取和更新活动预算 更新活动预算的以下代码失败: def gc_cloud_set_budget(client, customer_id, budget_id, amount): account_budget_proposal_service = client.get_service("AccountBudgetProposalService") account_budget_proposal_operation = client

我正在使用谷歌广告python获取和更新活动预算

更新活动预算的以下代码失败:

def gc_cloud_set_budget(client, customer_id, budget_id, amount):
    account_budget_proposal_service = client.get_service("AccountBudgetProposalService")
    account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
    proposal = account_budget_proposal_operation.create
    proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.UPDATE
    proposal.account_budget = f"customers/{customer_id}/accountBudgets/{budget_id}"
    proposal.proposed_spending_limit_micros = int(amount * 1000000)
    field_mask = protobuf_helpers.field_mask(None, proposal._pb)
    account_budget_proposal_operation.update_mask.CopyFrom(field_mask)
    account_budget_proposal_response = (
        account_budget_proposal_service.mutate_account_budget_proposal(
            customer_id=customer_id,
            operation=account_budget_proposal_operation,
        )
    )
错误是:

google.ads.googleads.errors.GoogleAdsException: (<_InactiveRpcError of RPC that terminated with:
    status = StatusCode.INVALID_ARGUMENT
    details = "Request contains an invalid argument."
    debug_error_string = "{"created":"@1619962240.888417850","description":"Error received from peer ipv4:172.217.173.10:443","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
>, <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.INVALID_ARGUMENT
    details = "Request contains an invalid argument."
    debug_error_string = "{"created":"@1619962240.888417850","description":"Error received from peer ipv4:172.217.173.10:443","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
>, errors {
  error_code {
    mutate_error: RESOURCE_NOT_FOUND
  }
  message: "Resource was not found."
  location {
    field_path_elements {
      field_name: "operation"
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "account_budget"
    }
  }
}
, 'zgcb92q5-lH7TzURxjbWMw')
发送到google api的请求如下:

customer_id: "**********"
operation {
  create {
    proposal_type: UPDATE
    account_budget: "customers/**********/accountBudgets/**************"
    proposed_spending_limit_micros: 10000
  }
  update_mask {
    paths: "account_budget"
    paths: "proposal_type"
    paths: "proposed_spending_limit_micros"
  }
}
有什么帮助吗

customer_id: "**********"
operation {
  create {
    proposal_type: UPDATE
    account_budget: "customers/**********/accountBudgets/**************"
    proposed_spending_limit_micros: 10000
  }
  update_mask {
    paths: "account_budget"
    paths: "proposal_type"
    paths: "proposed_spending_limit_micros"
  }
}