I'm tring to add account budget for a google-ads account, followed example 
provided by goolge-ads-python lib.
from __future__ import absolute_import

import argparse
import sys
import os
import six

import google.ads.google_ads.client



os.environ['https_proxy'] = 'https_proxy8'

GG_DEVELOP_TOKEN = "GG_DEVELOP_TOKEN "


credentials_dict_bv = {"token_uri": "https://oauth2.googleapis.com/token";, 
"token": None, "scopes": ["https://www.googleapis.com/auth/adwords";, 
"https://www.googleapis.com/auth/userinfo.profile";, 
"https://www.googleapis.com/auth/userinfo.email";, "openid"], "client_id": 
"7545454xxxx934-aol074ktdv9tb5435xxxxnrk4v368sq.apps.googleusercontent.com", 
"refresh_token": "1/jqqxxxSYHMDXdB8ABIxxxxxKzwDq-zEf8", "client_secret": 
"LxxxYC0q6VxxxxYsED"}



def main(client, customer_id, billing_setup_id):
    account_budget_proposal_service = client.get_service(
        'AccountBudgetProposalService')
    billing_setup_service = client.get_service('BillingSetupService',
                                               version='v2')

    account_budget_proposal_operation = client.get_type(
        'AccountBudgetProposalOperation')
    proposal = account_budget_proposal_operation.create

    proposal.proposal_type = client.get_type(
        'AccountBudgetProposalTypeEnum').CREATE
    proposal.billing_setup.value = billing_setup_service.billing_setup_path(
        customer_id, billing_setup_id)
    proposal.proposed_name.value = 'Account Budget Proposal (example)'

    # Specify the account budget starts immediately
    proposal.proposed_start_time_type = client.get_type('TimeTypeEnum',
                                                        version='v2').NOW
    # Alternatively you can specify a specific start time. Refer to the
    # AccountBudgetProposal resource documentation for allowed formats.
    #
    # proposal.proposed_start_date_time = '2020-01-02 03:04:05'

    # Specify that the budget runs forever
    proposal.proposed_end_time_type = client.get_type('TimeTypeEnum',
                                                      version='v2').FOREVER
    # Alternatively you can specify a specific end time. Allowed formats 
are as
    # above.
    #
    # proposal.proposed_end_date_time = '2021-01-02 03:04:05'

    # Optional: set notes for the budget. These are free text and do not 
effect
    # budget delivery.
    #
    # proposal.proposed_notes = client.wrapper
    #     .string('Received prepayment of $0.01')
    proposal.proposed_spending_limit_micros.value = 0

    try:
        account_budget_proposal_response = (
          account_budget_proposal_service.mutate_account_budget_proposal(
              customer_id, account_budget_proposal_operation))

    except google.ads.google_ads.errors.GoogleAdsException as ex:
        import pprint
        pprint.pprint(ex)
        print('Request with ID "%s" failed with status "%s" and includes 
the '
              'following errors:' % (ex.request_id, ex.error.code().name))
        for error in ex.failure.errors:
            print('\tError with message "%s".' % error.message)
            if error.location:
                for field_path_element in 
error.location.field_path_elements:
                    print('\t\tOn field: %s' % 
field_path_element.field_name)
        sys.exit(1)

    print('Created account budget proposal "%s".'
          % account_budget_proposal_response.result.resource_name)


if __name__ == '__main__':
    # GoogleAdsClient will read the google-ads.yaml configuration file in 
the
    # home directory if none is specified.
    credentials = 
google.oauth2.credentials.Credentials(**credentials_dict_bv)
    client = google.ads.google_ads.client.GoogleAdsClient(credentials, 
GG_DEVELOP_TOKEN, login_customer_id='58564568752')


    parser = argparse.ArgumentParser(
        description='Creates an account budget proposal.')
    # The following argument(s) should be provided to run the example.
    parser.add_argument('-c', '--customer_id', type=six.text_type,
                        required=True, help='The Ads customer ID.')
    parser.add_argument('-b', '--billing_setup_id', type=six.text_type,
                        required=True, help='The billing setup ID.')
    args = parser.parse_args()

    main(client, args.customer_id, args.billing_setup_id)


but  I get error like 
/MutateAccountBudgetProposal, RequestId: mHN4Q6gXp1pAD5SJ1zdSfg, IsFault: 
True, FaultMessage: Resource was not found.
GoogleAdsException(<_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = 
"{"created":"@1568260765.293884322","description":"Error received from peer 
ipv4:10.0.0.19:8118","file":"src/core/lib/sur                              
                                                                      
face/call.cc","file_line":1052,"grpc_message":"Request contains an invalid 
argument.","grpc_status":3}"
>, <_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = 
"{"created":"@1568260765.293884322","description":"Error received from peer 
ipv4:10.0.0.19:8118","file":"src/core/lib/sur                              
                                                                      
face/call.cc","file_line":1052,"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: "billing_setup"
    }
  }
}
, 'mHN4Q6gXp1pAD5SJ1zdSfg')
Request with ID "mHN4Q6gXp1pAD5SJ1zdSfg" failed with status 
"INVALID_ARGUMENT" and includes the following errors:
        Error with message "Resource was not found.".
                On field: operation
                On field: create
                On field: billing_setup
(google_test) [jiamin@domob-206 test_01]$ python add_account_budget.py -c 
9834324964 -b 497361765
Request made: ClientCustomerId: 9834324964, Host: 
googleads.googleapis.com:443, Method: 
/google.ads.googleads.v2.services.AccountBudgetProposalService              
                                                                            
          /MutateAccountBudgetProposal, RequestId: Forr5vN5cGRCNA3g6epzRg, 
IsFault: True, FaultMessage: Resource was not found.
GoogleAdsException(<_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = 
"{"created":"@1568260826.213461575","description":"Error received from peer 
ipv4:10.0.0.19:8118","file":"src/core/lib/sur                              
                                                                      
face/call.cc","file_line":1052,"grpc_message":"Request contains an invalid 
argument.","grpc_status":3}"
>, <_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = 
"{"created":"@1568260826.213461575","description":"Error received from peer 
ipv4:10.0.0.19:8118","file":"src/core/lib/sur                              
                                                                      
face/call.cc","file_line":1052,"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: "billing_setup"
    }
  }
}
, 'Forr5vN5cGRCNA3g6epzRg')
Request with ID "Forr5vN5cGRCNA3g6epzRg" failed with status 
"INVALID_ARGUMENT" and includes the following errors:
        Error with message "Resource was not found.".
                On field: operation
                On field: create
                On field: billing_setup


Why this error happened?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e8fe8f7f-0461-455a-a6e0-470ecfdde283%40googlegroups.com.

Reply via email to