简体   繁体   中英

Send multiple tweets(mentions) with multiple accounts Twitter4j

I am designing an application using which the users would be able to send multiple tweets(mentions) from multiple accounts and am using Twitter4j for the same. Regarding this, I have a few questions:

  1. Authentication : The application has an authentication part.I am able to authenticate using the PIN based authentication(oob).But I want to know if it is possible to persist the access token such that the user only needs to authenticate once at the time of installing the app and never thereafter.
  2. Exception Handling : The application would be sending multiple tweets.So I wish to know that what would be the way to check for exceptions, particularly the suspension of user account.
  3. Limit : What would be a safe rate(I mean minimum interval between two tweets) to send the tweets hourly or per minute. Does twitter also check for the IP of the machine for suspending the accounts? I mean suppose I need to send 60 tweets.If I am using 4 accounts to do the same with 15 tweets per account and run 4 threads for the same, will that allow me to send more tweets form my app?

EDIT Kindly note that I am making a desktop app, not a web app.So a PIN based authentication is necessary. Also I am not sure about the validity lifetime of an access token.Will the access token once generated by using OOB authentication be valid forever so that I can save it in a database and hence enable user to authenticate only once?

Some points to note:

  • Authentication : It is possible to get the access token without using pin based authentication, for that when you create an application you have to specify a callback url, and so you dont have to copy and paste the pin, instead a parameter oauth_verifier is appended with the callback url which you can fetch from the url itself. With this oauth_verifier , you can get a ccess_token and token_secret as mentioned here
  • Exception Handling : Nothing other than simple try catch can be more helpful here.
  • Limit : There are two initial buckets available for GET requests: 15 calls every 15 minutes, and 180 calls every 15 minutes. Refer here for more details.

Edit: For desktop app there is no other alternative, so you have to do a pin based authentication and since twitter works on Oauth1, so as of now, the validity of the access_token and token_secret is lifetime. So authentication is required only once and the api calls can be made using same tokens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM