我们正在使用Google Adwords API(v201710)来获取客户信息,广告组和广告系列信息。
Google Adwords将默认超时设置为20分钟。如果出现 Read Timed Out (读取超时)异常,这会导致线程挂起,从而导致问题。
示例代码:
GoogleCredential credentials = new GoogleCredential.Builder().setClientSecrets(CLIENT_ID, CLIENT_SECRET).setJsonFactory(jsonFactory).setTransport(httpTransport).build().setAccessToken(accessToken);
AdWordsSession session = new AdWordsSession.Builder().withUserAgent(useragent).withOAuth2Credential(credentials).withDeveloperToken(DEVELOPER_TOKEN).build();
CustomerServiceInterface mcs = new AdWordsServices().get(session, CustomerServiceInterface.class);
Customer[] cs = mcs.getCustomers();
是否可以为Adwords管理api设置超时值?