TwitterException {statusCode = 403, retryAfter = 0, rateLimitStatus = null}

Recently, I noticed that when I searched on twitter, I get a 403 error. My application worked up to two days ago when I noticed an error.

I checked with Twitter and they say that my IP address is not blocked, I am also within the speed limit = about 60 searches / hour.

This is how I initialized the Twitter object -

private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance(); 

After I noticed the error, I tried the following and still have not succeeded -

 private static Twitter TWITTER_CLIENT = new TwitterFactory().getInstance("user", "password"); 

This is how I am looking -

 TWITTER_CLIENT.search(new Query("#keyword1 OR #keyword2")); 

I tried this URL (curl http://search.twitter.com/search.json?q=ipad ) from my server and it works well.

The following is an exception. I am on java6 + Twitter4j v2.1.2. It would be very helpful to help. Thanks.

 TwitterException{statusCode=403, retryAfter=0, rateLimitStatus=null} at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:301) at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:68) at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:82) at twitter4j.Twitter.search(Twitter.java:193) 
+4
source share
2 answers

Most likely, the reason is the basic shutdown using Twitter (aka OAuthcalypse):

Base stop completed

You need to switch to OAuth .

0
source

I recently got the same error while executing similar code. To fix this, go to

  • https://apps.twitter.com/app/your_app_id
  • Click "Keys and Access Token"
  • In the "Access level" section, click "Change application permission" and select the third option: "Read, write and access direct messages"
  • Click on update. (Note: you may need to add your mobile number and check with otp to get this access if you don’t have your twitter add).
  • Restore both the consumer key and the secretand Access token and secret using the clickable button
  • New keys in your program

And you're done! Your program will start working.

0
source

All Articles