Hi,

I have developed a DAG in Airflow to upload call conversion. I have 
installed *google-ads==18.0.0 *in my Airflow as I cannot upgrade to newer 
versions due to some constraints in my Airflow environment. The version of  
google Ads API which I am seeing is v11. So when I run my code it gives me 
error
"*Request made: ClientCustomerId: XXXXXXXXXX, Host: 
googleads.googleapis.com, Method: 
/google.ads.googleads.v11.services.ConversionUploadService/UploadCallConversions,
 
RequestId: None, IsFault: True, FaultMessage: GRPC target method can't be 
resolved.*" 

kindly confirm is the google Ads API v11 deprecated or any other issue in 
my implementation. My sample code is given below:

import os
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException

def main():
    try:
        
        current_dir = os.path.dirname(os.path.abspath(__file__))
        json_key_file_path = os.path.join(current_dir, "api.json")

        credentials = {
            "json_key_file_path": f"{json_key_file_path}",
            "impersonated_email": "x...@yyy.com",
            "use_proto_plus": True,
            "developer_token": "XXXYYYZZZZ",
            "login_customer_id": "11111111"
        }

    
        client = GoogleAdsClient.load_from_dict(credentials)

        customer_id = "XXXXXXXXX"
        conversion_action_id = "XXXXXXXXX"
        conversion_upload_service = 
client.get_service("ConversionUploadService")
        call_data_list = [
            {
                "caller_id": "+18184392881",
                "call_start_date_time": "2024-05-23 12:18:43-06:00",
                "conversion_date_time": "2024-05-23 12:41:00-06:00",
                "conversion_value": 28.66
            },
            {
                "caller_id": "+12405736262",
                "call_start_date_time": "2024-05-23 11:48:58-06:00",
                "conversion_date_time": "2024-05-23 13:47:00-06:00",
                "conversion_value": 22.81
            }
        ]

        call_conversions = []

        for call_data in call_data_list:
            call_conversion = client.get_type("CallConversion")
            call_conversion.conversion_action = client.get_service(
                "ConversionActionService"
            ).conversion_action_path(customer_id, conversion_action_id)
            call_conversion.caller_id = call_data["caller_id"]
            call_conversion.call_start_date_time = 
call_data["call_start_date_time"]
            call_conversion.conversion_date_time = 
call_data["conversion_date_time"]
            call_conversion.conversion_value = call_data["conversion_value"]
            call_conversion.currency_code = "USD"
            call_conversions.append(call_conversion)

        request = client.get_type("UploadCallConversionsRequest")
        request.customer_id = customer_id
        request.conversions.extend(call_conversions)
        request.partial_failure = True

        upload_call_conversions_response = (
            
conversion_upload_service.upload_call_conversions(request=request)
        )

        if upload_call_conversions_response.partial_failure_error:
            print(
                "Partial error occurred: "
                
f"'{upload_call_conversions_response.partial_failure_error.message}'"
            )

        for result in upload_call_conversions_response.results:
            if result.call_start_date_time:
                print(
                    "Uploaded call conversion that occurred at "
                    f"'{result.call_start_date_time}' "
                    f"for caller ID '{result.caller_id}' "
                    "to the conversion action with resource name "
                    f"'{result.conversion_action}'."
                )

    except GoogleAdsException as ex:
        print(
            f"Request with ID '{ex.request_id}'' failed with status "
            f"'{ex.error.code().name}' and includes the following errors:"
        )
        for error in ex.failure.errors:
            print(f"\tError with message '{error.message}'.")
            if error.location:
                for field_path_element in 
error.location.field_path_elements:
                    print(f"\t\tOn field: {field_path_element.field_name}")

if __name__ == "__main__":
    main()

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/a59adf6d-551c-4ff6-977b-31c1e343653an%40googlegroups.com.
  • Up... salman baqir
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to