403:The request is understood, but it has been refused Twitter Android

两盒软妹~` 提交于 2019-12-06 17:29:08

问题


I am trying to tweet on twitter from android. Now for this i have create an application on dev.twitter and downloaded sample code from this link and update both keys with my app keys.

Now i run the code authenticate the account and after it i tweet and this tweet includes image and text both image was on URL as define in sample code. Now i first time it shows me image and text successfully uploaded but when i try to again tweet it gives me 403 status update error.

For this i change the text message "status Text" and image URL but still it is giving me "403 status" update error. I have the same code as written in sample code only keys are changed.

Here is my Logcat:

10-04 11:26:25.015: W/System.err(22822): 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
10-04 11:26:25.015: W/System.err(22822): message - Error creating status.
10-04 11:26:25.015: W/System.err(22822): code - 189
10-04 11:26:25.025: W/System.err(22822): Relevant discussions can be found on the Internet at:
10-04 11:26:25.025: W/System.err(22822):    http://www.google.co.jp/search?q=b2b52c28 or
10-04 11:26:25.025: W/System.err(22822):    http://www.google.co.jp/search?q=11331d43
10-04 11:26:25.025: W/System.err(22822): TwitterException{exceptionCode=[b2b52c28-11331d43], statusCode=403, message=Error creating status., code=189, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
10-04 11:26:25.025: W/System.err(22822):    at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
10-04 11:26:25.025: W/System.err(22822):    at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
10-04 11:26:25.025: W/System.err(22822):    at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
10-04 11:26:25.030: W/System.err(22822):    at twitter4j.TwitterImpl.post(TwitterImpl.java:1871)
10-04 11:26:25.030: W/System.err(22822):    at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:252)
10-04 11:26:25.030: W/System.err(22822):    at chintan.khetiya.android.Twitter_code.Twitt_Sharing.Share_Pic_Text_Titter(Twitt_Sharing.java:126)
10-04 11:26:25.030: W/System.err(22822):    at chintan.khetiya.android.Twitter_code.Twitt_Sharing$PostTwittTask.doInBackground(Twitt_Sharing.java:91)
10-04 11:26:25.030: W/System.err(22822):    at chintan.khetiya.android.Twitter_code.Twitt_Sharing$PostTwittTask.doInBackground(Twitt_Sharing.java:1)
10-04 11:26:25.030: W/System.err(22822):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
10-04 11:26:25.035: W/System.err(22822):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
10-04 11:26:25.035: W/System.err(22822):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
10-04 11:26:25.040: W/System.err(22822):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
10-04 11:26:25.040: W/System.err(22822):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
10-04 11:26:25.040: W/System.err(22822):    at java.lang.Thread.run(Thread.java:856)

回答1:


I had this same error and upgrading to the latest version of twitter4j 3.0.5 (at the time of this writing) fixed the issue.

Get the latest here http://twitter4j.org/en/index.html#download

EDIT: I should mention that the version i was running was twitter4j 3.0.3. So by going to version 3.0.5 or 3.0.6 fixed the issue for me.




回答2:


in

ConfigurationBuilder cb = new ConfigurationBuilder();

add cb.setUseSSL(true)

it will work

redirect url ssl required make sure your application running on https.




回答3:


I encountered this error when I wanted to share an image with a wrong a url. Turned out I set the wrong folder in the url, Twitter didn't find the image thus throw an error. Question is, why do they show this error instead of something like "wrong url".

You may also run into this error when your are trying to post a longer text. I ran into this when I wanted to share a text (124 characters) and a link (10) characters and it didn't let me post it.




回答4:


Found this problem again in the non-stable version 4.0.6.

Try not using maven in the way is specified in twitteer4j's website, which is this:

 <dependencies>
      <dependency>
           <groupId>org.twitter4j</groupId>
           <artifactId>twitter4j-core</artifactId>
           <version>[4.0,)</version>
       </dependency>
       ...
   </dependencies>

Instead, put an specific version (current stable is 4.0.4 and fix this problem, but [4.0,) gets the newest from 4.0, so 4.0.6)

 <dependencies>
      <dependency>
           <groupId>org.twitter4j</groupId>
           <artifactId>twitter4j-core</artifactId>
           <version>4.0.4</version>
       </dependency>
       ...
   </dependencies>


来源:https://stackoverflow.com/questions/19174856/403the-request-is-understood-but-it-has-been-refused-twitter-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!