Python - Input in composite field

2020-08-26 Thread Kasper Aamodt
Is there a way to copy a text string from one variable to another, without 
it pointing at it, so it just looks like a string to the compiler(if that 
is the right word)? Im trying to make an account budget with the google ads 
api, and to set a start date, you have to hard code in a string with the 
date, but i want to be able to change the start date for each budget. It 
wont work with input, or reading a string from a file, i get this error:

AttributeError: Assignment not allowed to composite field 
"proposed_start_date_time" in protocol message object.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/49158ef2-1d90-406a-aa80-4b7c1e8cda15n%40googlegroups.com.


Input in composite field

2020-08-26 Thread Kasper Aamodt


Is there a way to copy a text string from one variable to another, without 
it pointing at it, so it just looks like a string to the compiler(if that 
is the right word)? Im trying to make an account budget with the google ads 
api, and to set a start date, you have to hard code in a string with the 
date, but i want to be able to change the start date for each budget. It 
wont work with input, or reading a string from a file, i get this error:

AttributeError: Assignment not allowed to composite field 
"proposed_start_date_time" in protocol message object.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/4efa5bc1-a2ca-4cae-90a2-5d07c9732aban%40googlegroups.com.


Connect existing billing setup to new customer

2020-08-24 Thread Kasper Aamodt
import sys
import codecs, os


import google.ads.google_ads.client
import logging
logging.basicConfig(level=logging.INFO, format='[%(asctime)s - 
%(levelname)s] %(message).5000s')
logging.getLogger('google.ads.google_ads.client').setLevel(logging.INFO)


def main(client, customer_id, payment_account):


billing_setup_service = client.get_service('BillingSetupService',
version='v4')

billing_setup_operation = client.get_type('BillingSetupOperation',
version='v4')

billing_setup_operation.create = billing_setup_service.billing_setup_path(
customer_id, payment_account)

try:
billing_setup_response = billing_setup_service.mutate_billing_setup(
customer_id, billing_setup_operation)
except google.ads.google_ads.errors.GoogleAdsException as 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('Removed billing setup %s.'
% billing_setup_response.results[0].resource_name)

def run():
# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.
google_ads_client = (google.ads.google_ads.client.GoogleAdsClient
.load_from_storage("C:\\Users\\Kasper 
Aamodt\\PycharmProjects\\google-ads-master\\google-ads.yaml"))

customer_id = 'x'
payment_account = ''

main(google_ads_client, customer_id, payment_account)

run()

*That is the code i have, and it returns: *

Traceback (most recent call last):
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 60, in 
run()
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 58, in run
main(google_ads_client, customer_id, payment_account)
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 25, in main
billing_setup_operation.create = 
billing_setup_service.billing_setup_path(
  File "C:\Users\Kasper 
Aamodt\Env\venv\lib\site-packages\google\protobuf\internal\python_message.py", 
line 766, in setter
raise AttributeError('Assignment not allowed to composite field '
AttributeError: Assignment not allowed to composite field "create" in 
protocol message object.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cc8fde66-1bfa-4022-b08e-be8cc28a34a3n%40googlegroups.com.


Connect existing billing setup to new customer - Assignment not allowed to composite field "create" in protocol message object.

2020-08-24 Thread Kasper Aamodt
import sys
import codecs, os


import google.ads.google_ads.client
import logging
logging.basicConfig(level=logging.INFO, format='[%(asctime)s - 
%(levelname)s] %(message).5000s')
logging.getLogger('google.ads.google_ads.client').setLevel(logging.INFO)


def main(client, customer_id, payment_account):


billing_setup_service = client.get_service('BillingSetupService',
version='v4')

billing_setup_operation = client.get_type('BillingSetupOperation',
version='v4')

billing_setup_operation.create = billing_setup_service.billing_setup_path(
customer_id, payment_account)

try:
billing_setup_response = billing_setup_service.mutate_billing_setup(
customer_id, billing_setup_operation)
except google.ads.google_ads.errors.GoogleAdsException as 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('Removed billing setup %s.'
% billing_setup_response.results[0].resource_name)

def run():
# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.
google_ads_client = (google.ads.google_ads.client.GoogleAdsClient
.load_from_storage("C:\\Users\\Kasper 
Aamodt\\PycharmProjects\\google-ads-master\\google-ads.yaml"))

customer_id = '8159363545'
payment_account = '8997522857169420'

main(google_ads_client, customer_id, payment_account)

run()

*That is the code i have, and it returns: *

Traceback (most recent call last):
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 60, in 
run()
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 58, in run
main(google_ads_client, customer_id, payment_account)
  File "C:/Users/Kasper 
Aamodt/PycharmProjects/google-ads-master/in_use/connect_billing_account.py", 
line 25, in main
billing_setup_operation.create = 
billing_setup_service.billing_setup_path(
  File "C:\Users\Kasper 
Aamodt\Env\venv\lib\site-packages\google\protobuf\internal\python_message.py", 
line 766, in setter
raise AttributeError('Assignment not allowed to composite field '
AttributeError: Assignment not allowed to composite field "create" in 
protocol message object.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/68174da2-7ae1-4fc5-9418-6d375176ff46n%40googlegroups.com.


Re: [Google Ads API] Add account budget - Resource not found

2020-08-18 Thread Kasper Aamodt
And do you have a python example of adding an existing payment profile to a 
customer? I'm pretty new when it comes to this, so I'm relying heavily on 
the code examples.

On Tuesday, August 18, 2020 at 11:19:39 PM UTC+2 Kasper Aamodt wrote:

> Hi, thank you! 
>
> I know that that is possible, but that would mean that i have to change 
> the code for every new budget we make. Is it possible to set start and end 
> time with the input method? Something like this, or another way:
>
> start_time = input("Start time (-MM-dd HH:mm:ss): ")
>
> proposal.proposed_end_date_time = str(start_time)
>
>  
>
> On Tuesday, August 18, 2020 at 7:30:57 PM UTC+2 adsapiforumadvisor wrote:
>
>> Hi Kasper,
>>
>> Yes, it is possible that you are getting the RESOURCE_NOT_FOUND error 
>> because you do not have a payment profile connected to your customer 
>> account. Please create one and try your request again.
>>
>> Below are my responses to your questions:
>>
>> *How do I connect new customer accounts with our default payment profile, 
>> through the API?* 
>>
>>- To connect your new customer account to a payment profile via API, 
>>you can follow this 
>>
>> <https://developers.google.com/google-ads/api/docs/billing/billing-setups#creating_new_billing_setups>
>> guide.  
>>
>> *Is it possible to set the start and end date for budgets with the 
>> add_account_budget_proposal? * 
>>
>>- Yes, it is possible to set the start and end date for budgets by 
>>specifying the *proposed_start_date_time* and *proposed_end_date_time*. 
>>Please note that the format of these fields should be like the following 
>>example: 2021-01-02 03:04:05 
>>
>> Let me know if you have any additional questions or encounter any other 
>> issues. 
>>
>> Regards,
>> Danica, Google Ads API Team
>>
>> ref:_00D1U1174p._5004Q23L35f:ref
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/12d514d8-b446-48dc-bdc6-3bcec82193d9n%40googlegroups.com.


Re: [Google Ads API] Add account budget - Resource not found

2020-08-18 Thread Kasper Aamodt
Hi, thank you! 

I know that that is possible, but that would mean that i have to change the 
code for every new budget we make. Is it possible to set start and end time 
with the input method? Something like this, or another way:

start_time = input("Start time (-MM-dd HH:mm:ss): ")

proposal.proposed_end_date_time = str(start_time)

 

On Tuesday, August 18, 2020 at 7:30:57 PM UTC+2 adsapiforumadvisor wrote:

> Hi Kasper,
>
> Yes, it is possible that you are getting the RESOURCE_NOT_FOUND error 
> because you do not have a payment profile connected to your customer 
> account. Please create one and try your request again.
>
> Below are my responses to your questions:
>
> *How do I connect new customer accounts with our default payment profile, 
> through the API?* 
>
>- To connect your new customer account to a payment profile via API, 
>you can follow this 
>
> 
> guide.  
>
> *Is it possible to set the start and end date for budgets with the 
> add_account_budget_proposal? * 
>
>- Yes, it is possible to set the start and end date for budgets by 
>specifying the *proposed_start_date_time* and *proposed_end_date_time*. 
>Please note that the format of these fields should be like the following 
>example: 2021-01-02 03:04:05 
>
> Let me know if you have any additional questions or encounter any other 
> issues. 
>
> Regards,
> Danica, Google Ads API Team
>
> ref:_00D1U1174p._5004Q23L35f:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/55774d35-7296-48b1-9211-1af8d3e4e7a5n%40googlegroups.com.


Re: [Google Ads API] Add account budget - Resource not found

2020-08-18 Thread Kasper Aamodt
And another question, is it possible to set the start and end date for 
budgets with the  add_account_budget_proposal ? 

On Tuesday, August 18, 2020 at 9:44:06 AM UTC+2 Kasper Aamodt wrote:

> I think i know why it does not work. It's probably because it is a new 
> account, so it does not have a payment profile connected to the account 
> yet. So now my question is, how do i connect new customer accounts with our 
> default payment profile, thrugh the API?
>
> On Tuesday, August 18, 2020 at 9:21:53 AM UTC+2 Kasper Aamodt wrote:
>
>> Hi,
>>
>> I'm trying to add a budget to an account. I'm using the 
>> add_account_budget_proposal example. 
>>
>> This is the error message and log:
>>
>> [2020-08-18 09:15:35,440 - INFO] Request
>> ---
>> Method: 
>> /google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal
>> Host: googleads.googleapis.com:443
>> Headers: {
>>   "developer-token": "REDACTED",
>>   "login-customer-id": "xx",
>>   "x-goog-api-client": "gl-python/3.8.5 grpc/1.31.0 gax/1.22.1 
>> gapic/6.0.0",
>>   "x-goog-request-params": "customer_id=xx"
>> }
>> Request: customer_id: "xx"
>> operation {
>>   create {
>> billing_setup {
>>   value: "customers/xx/billingSetups/"
>> }
>> proposal_type: CREATE
>> proposed_name {
>>   value: "Account Budget Proposal (example)"
>> }
>> proposed_start_time_type: NOW
>> proposed_end_time_type: FOREVER
>> proposed_spending_limit_micros {
>>   value: 100
>> }
>>   }
>> }
>>
>>
>> Response
>> ---
>> Headers: {
>>   "google.ads.googleads.v4.errors.googleadsfailure-bin": 
>> "\nG\n\u00028\u0003\u0012\u0017Resource was not 
>> found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
>>   "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid 
>> argument.\u001a\u0001\
>> nCtype.googleapis.com/google.ads.googleads.v4.errors.GoogleAdsFailure\u0012I\nG\n\u00028\u0003\u0012\u0017Resource
>>  
>> <http://nCtype.googleapis.com/google.ads.googleads.v4.errors.GoogleAdsFailure%5Cu0012I%5CnG%5Cn%5Cu00028%5Cu0003%5Cu0012%5Cu0017Resource>
>>  
>> was not 
>> found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
>>   "request-id": "rBUXCldjFfi41xHtznIVgw"
>> }
>> Fault: 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"
>> }
>>   }
>> }
>>
>>
>> [2020-08-18 09:15:35,440 - WARNING] Request made: ClientCustomerId: 
>> xx, Host: googleads.googleapis.com:443, Method: 
>> /google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal,
>>  
>> RequestId: rBUXCldjFfi41xHtznIVgw, IsFault: True, FaultMessage: Resource 
>> was not found.
>>
>> Thanks
>> Kasper
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/44461e8b-62c7-495b-9b27-640bd1917062n%40googlegroups.com.


Re: [Google Ads API] Add account budget - Resource not found

2020-08-18 Thread Kasper Aamodt
I think i know why it does not work. It's probably because it is a new 
account, so it does not have a payment profile connected to the account 
yet. So now my question is, how do i connect new customer accounts with our 
default payment profile, thrugh the API?

On Tuesday, August 18, 2020 at 9:21:53 AM UTC+2 Kasper Aamodt wrote:

> Hi,
>
> I'm trying to add a budget to an account. I'm using the 
> add_account_budget_proposal example. 
>
> This is the error message and log:
>
> [2020-08-18 09:15:35,440 - INFO] Request
> ---
> Method: 
> /google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal
> Host: googleads.googleapis.com:443
> Headers: {
>   "developer-token": "REDACTED",
>   "login-customer-id": "xx",
>   "x-goog-api-client": "gl-python/3.8.5 grpc/1.31.0 gax/1.22.1 
> gapic/6.0.0",
>   "x-goog-request-params": "customer_id=xx"
> }
> Request: customer_id: "xx"
> operation {
>   create {
> billing_setup {
>   value: "customers/xx/billingSetups/"
> }
> proposal_type: CREATE
> proposed_name {
>   value: "Account Budget Proposal (example)"
> }
> proposed_start_time_type: NOW
> proposed_end_time_type: FOREVER
> proposed_spending_limit_micros {
>   value: 100
> }
>   }
> }
>
>
> Response
> ---
> Headers: {
>   "google.ads.googleads.v4.errors.googleadsfailure-bin": 
> "\nG\n\u00028\u0003\u0012\u0017Resource was not 
> found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
>   "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid 
> argument.\u001a\u0001\
> nCtype.googleapis.com/google.ads.googleads.v4.errors.GoogleAdsFailure\u0012I\nG\n\u00028\u0003\u0012\u0017Resource
>  
> <http://nCtype.googleapis.com/google.ads.googleads.v4.errors.GoogleAdsFailure%5Cu0012I%5CnG%5Cn%5Cu00028%5Cu0003%5Cu0012%5Cu0017Resource>
>  
> was not 
> found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
>   "request-id": "rBUXCldjFfi41xHtznIVgw"
> }
> Fault: 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"
> }
>   }
> }
>
>
> [2020-08-18 09:15:35,440 - WARNING] Request made: ClientCustomerId: 
> xx, Host: googleads.googleapis.com:443, Method: 
> /google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal,
>  
> RequestId: rBUXCldjFfi41xHtznIVgw, IsFault: True, FaultMessage: Resource 
> was not found.
>
> Thanks
> Kasper
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/14affbde-572b-433f-859f-aba8a9c1373dn%40googlegroups.com.


[Google Ads API] Add account budget - Resource not found

2020-08-18 Thread Kasper Aamodt
Hi,

I'm trying to add a budget to an account. I'm using the 
add_account_budget_proposal example. 

This is the error message and log:

[2020-08-18 09:15:35,440 - INFO] Request
---
Method: 
/google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal
Host: googleads.googleapis.com:443
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "xx",
  "x-goog-api-client": "gl-python/3.8.5 grpc/1.31.0 gax/1.22.1 gapic/6.0.0",
  "x-goog-request-params": "customer_id=xx"
}
Request: customer_id: "xx"
operation {
  create {
billing_setup {
  value: "customers/xx/billingSetups/"
}
proposal_type: CREATE
proposed_name {
  value: "Account Budget Proposal (example)"
}
proposed_start_time_type: NOW
proposed_end_time_type: FOREVER
proposed_spending_limit_micros {
  value: 100
}
  }
}


Response
---
Headers: {
  "google.ads.googleads.v4.errors.googleadsfailure-bin": 
"\nG\n\u00028\u0003\u0012\u0017Resource was not 
found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
  "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid 
argument.\u001a\u0001\nCtype.googleapis.com/google.ads.googleads.v4.errors.GoogleAdsFailure\u0012I\nG\n\u00028\u0003\u0012\u0017Resource
 
was not 
found.\"(\u0012\u000b\n\toperation\u0012\b\n\u0006create\u0012\u000f\n\rbilling_setup",
  "request-id": "rBUXCldjFfi41xHtznIVgw"
}
Fault: 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"
}
  }
}


[2020-08-18 09:15:35,440 - WARNING] Request made: ClientCustomerId: 
xx, Host: googleads.googleapis.com:443, Method: 
/google.ads.googleads.v4.services.AccountBudgetProposalService/MutateAccountBudgetProposal,
 
RequestId: rBUXCldjFfi41xHtznIVgw, IsFault: True, FaultMessage: Resource 
was not found.

Thanks
Kasper

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/102e790d-ff36-42f5-a8dc-c37d5938c014n%40googlegroups.com.


How to set request header in google ads api

2020-08-17 Thread Kasper Aamodt

0


I want to propose a budget for an ads account under my manager account. I 
have the following YAML file:

developer_token: 13245
login-customer-id: 1324567891
customer-id: 1324567891
user_agent:  13245
client_id: 13245
client_secret: 13245
refresh_token: 13245

When i try to run my script, i get this error:

Error with message

"User doesn't have permission to access customer. Note: If you're accessing 
a client customer, the manager's customer id must be set in the 
'login-customer-id' header.

This is the code that i use, from the example python library:

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

I know that i somehow havent set the login_customer_id right in the header, how 
do i implement it?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/091e8ef8-127a-445b-a18b-388968a3b70co%40googlegroups.com.