Create account timeout

35 views
Skip to first unread message

Maxime Heurtevent

unread,
Oct 19, 2023, 3:24:14 AM10/19/23
to Google Ads API and AdWords API Forum
Hello, I followed the playlist available on your youtube channel allowing the initialization of one of the API, however when I want to create an account according to the way you describe in the documentation, my server crashes due to a timeout, the function used below:

def create_customer(token):
    client = create_client(token)
    manager_customer_id = bytes(****)

    customer_service = client.get_service("CustomerService")
    customer = client.get_type("Customer")
    now = datetime.today().strftime("%Y%m%d %H%M%S")
    customer.descriptive_name = f"Account created with CustomerService on {now}"

    customer.currency_code = "EUR"
    customer.time_zone = "Europe/Paris"

    try:
        response = customer_service.create_customer_client(
            customer_id=manager_customer_id,
            customer_client=customer,
        )
        print(
            f"Created customer with resource name '{response.resource_name}' "
            f"under manager account with ID '{manager_customer_id}'."
        )
        return response.resource_name
    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}")

    except Exception as e:
        print(f"Unexpected error {e}")
        return f"Unable to create customer: {e}"


and the call:

@app.route("/create-customer", methods=["POST"])
@cross_origin()
def create_customer():
    headers = request.headers
    token = headers["token"]
    result = create_customer(token)
    return jsonify({"message": result})


How can i rectify this? 

Thanks

Google Ads API Forum Advisor

unread,
Oct 19, 2023, 8:27:35 AM10/19/23
to m.77.heurtev...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

Can you please provide us with the playlist link you are referring to?

Could you please confirm whether you are using Google Ads API? If yes, could you please elaborate more on the issue you are facing? 

In order to assist you further, we would like to see the uncropped UI screenshot of the issue you are facing. Also if you are getting any error message, please provide us the error message along with complete API logs (request and response with request-id and request header).

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02pUTOr:ref"

Thanks,
 
Google Logo Google Ads API Team


Google Ads API Forum Advisor

unread,
Oct 20, 2023, 3:37:59 AM10/20/23
to adwor...@googlegroups.com, m.77.heurtev...@gmail.com
Hi,

Thank you for providing the requested logs.

I would suggest you to extend the API request time a little, and the timeout problem will no longer occur. The client library for Python doesn't specify any default timeouts, nor are any defaults specified at the gRPC transport layer. This means that, by default, the client library for Python fully delegates timeout behavior to the server. To override the default timeout, you need to add an extra parameter when calling the method. For more information on timeout, I would recommend you to refer to this documentation.

Let us know if you have any further queries.
Reply all
Reply to author
Forward
0 new messages