私は github Java API を使用しており、リポジトリとそのユーザーに関する情報を取得したいと考えています。私の質問は、API へのフル アクセス (5000 リクエスト/時間) を取得するためにリクエストを承認するにはどうすればよいかということです。また、API レート制限に到達しないように、アプリケーションに残っているリクエストの数をいつでも確認する方法があれば、非常に助かります。以下のコードは私が今行っていることですが、このコードではレート制限を超えています。
this.username = ConfigurationParser.parse("username");
this.password = ConfigurationParser.parse("password");
OAuthService oauthService = new OAuthService();
oauthService.getClient().setCredentials(this.username, this.password);
Authorization auth = new Authorization();
try {
auth = oauthService.createAuthorization(auth);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(auth.getApp().getName());
service.getClient().setOAuth2Token(auth.getToken());