diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-04-24 01:54:36 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-04-24 01:54:36 +0200 |
commit | 4d22f09283ad6ac66c0e76cc41747e0b8e492436 (patch) | |
tree | 1b9dc493acfa176423789029b8d87269e760c023 /src/mining/OAuthRequester.java | |
parent | c01a66426c00392dd7f8711d561b92af4da80779 (diff) | |
download | TwitterDataAnalytics-4d22f09283ad6ac66c0e76cc41747e0b8e492436.tar.gz |
Implement isValid, allow version spec for resource
Diffstat (limited to 'src/mining/OAuthRequester.java')
-rw-r--r-- | src/mining/OAuthRequester.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mining/OAuthRequester.java b/src/mining/OAuthRequester.java index e72360e..f5b6a10 100644 --- a/src/mining/OAuthRequester.java +++ b/src/mining/OAuthRequester.java @@ -5,6 +5,7 @@ import java.net.URLConnection; import oauth.signpost.OAuthConsumer; import oauth.signpost.basic.DefaultOAuthConsumer; import oauth.signpost.exception.OAuthException; +import org.json.JSONObject; /** * An API requester that uses OAuth to sign its requests. @@ -32,4 +33,12 @@ public class OAuthRequester extends AbstractRequester { throw new IOException(ex); } } + + @Override + public boolean isValid() throws IOException { + // NOTE: this actually contributes to the ratelimit (12/minute) + // TODO: find alternative that does not hit the ratelimit + JSONObject obj = getJSONRelax("1/application/rate_limit_status"); + return !obj.has("errors"); + } } |