|
||||||
Hi. Aryeh.
Thanks for your previous reply. But we are still having some issues with a new api.
One of the first steps of getting data from api is to create a client and pass security credentials into the client. The problem that we have is when credentials are not valid the API gets stuck and holds the request without response and without any timeout or error responses. For example, please see the code below.
Step 1. Creating a new client with invalid credentials
client = Google::Ads::GoogleAds::GoogleAdsClient.new do |config|
config.client_id = my_valid_adwords_client_id
config.client_secret = my_valid_adwords_client_secret
config.login_customer_id = my_valid_customer_id
config.refresh_token = 'invalid refresh token'
config.developer_token = my_valid_adwords_developer_token
end
Step 2. Trying to retrieve a data from API by using invalid client from Step 1
def create_keyword_plan
operation = client.operation.create_resource.keyword_plan do |kp|
kp.name = "Keyword plan for traffic estimate ##{timestamp}"
kp.forecast_period = client.resource.keyword_plan_forecast_period do |fp|
fp.date_interval = :NEXT_QUARTER
end
end
keyword_plan_service = client.service.keyword_plan
response = keyword_plan_service.mutate_keyword_plans(customer_id: my_valid_customer_id, operations: [operation])
response.results.first.resource_name
end
When code execution reaches this line
response = keyword_plan_service.mutate_keyword_plans(customer_id: my_valid_customer_id, operations: [operation])
The API gets stuck with no response. The longes that we waited was 30 min.
My questions are. Is there any way to avoid API from getting stuck if client data is invalid? And what is the API response timeout? Or how to handle cases like this?