gpt4 book ai didi

java - com.google.gdata.client.GoogleService$CaptchaRequiredException

转载 作者:行者123 更新时间:2023-11-30 09:46:14 25 4
gpt4 key购买 nike

我在执行 gdata api 示例代码时遇到错误。我是 api 的新手。请让我知道相同的解决方案。我需要在哪里放置验证码以及如何放置验证码。

SEVERE: Authentication Error: Captcha required com.google.gdata.client.GoogleService$CaptchaRequiredException: Captcha required at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:623) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:500) at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301) at com.google.gdata.client.appsforyourdomain.audit.AuditService.(AuditService.java:77) at AuditSampleClient.main(AuditSampleClient.java:100)

import java.util.Calendar;
import java.util.Properties;

import com.google.gdata.client.appsforyourdomain.audit.AuditService;
import com.google.gdata.client.appsforyourdomain.audit.MailBoxDumpRequest;
import com.google.gdata.data.TextConstruct;
import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException;
import com.google.gdata.data.appsforyourdomain.generic.GenericEntry;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;

public class google_data {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

export_data();
}
public static void export_data()
{
MailBoxDumpRequest request = new MailBoxDumpRequest();
request.setAdminEmailAddress("-----");
request.setUserEmailAddress("----------");

Calendar beginDate = Calendar.getInstance();
beginDate.set(2011, Calendar.AUGUST, 1, 4, 30);
request.setBeginDate(beginDate.getTime());

Calendar endDate = Calendar.getInstance();
endDate.set(2011, Calendar.AUGUST, 30, 20, 0);
request.setEndDate(endDate.getTime());

request.setIncludeDeleted(true);
request.setSearchQuery("in:chat");
request.setPackageContent("FULL_MESSAGE");

AuditService service = null;
try {
service = new AuditService("-----", "------", "------", "-------auditapp-v1");
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GenericEntry mailboxDumpEntry = null;
try {
mailboxDumpEntry = service.createMailboxDumpRequest(request);
} catch (AppsForYourDomainException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

TextConstruct requestId = mailboxDumpEntry.getSummary();
System.out.println(requestId.toString());
//String status = mailboxDumpEntry.getStatus();
//String numberOfFiles = mailboxDumpEntry.getNumberOfFiles();
}

}

最佳答案

这正是它所说的 - 该服务要求用户解决验证码,然后您才能再次使用自动登录。

异常(exception)应包含相关验证码的 URL。来自client login用户指南:

A failure response from ClientLogin contains an error code and a URL to an error page that can be displayed to the user. If the error code is a CAPTCHA challenge, the response also includes a URL to a CAPTCHA image and a special token. Your application should be able to solicit an answer from the user and then retry the login request.

URL 可通过 getCaptchaUrl() 获得方法。

关于java - com.google.gdata.client.GoogleService$CaptchaRequiredException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7239021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com