コード例 #1
0
 //	@Test
 public void testAuth() throws Exception {
   OAuthSignpostClient client =
       new OAuthSignpostClient(
           OAuthSignpostClient.JTWITTER_OAUTH_KEY,
           OAuthSignpostClient.JTWITTER_OAUTH_SECRET,
           "oob");
   client.authorizeDesktop();
   String v = client.askUser("Please enter the verification PIN from Twitter");
   client.setAuthorizationCode(v);
   // Optional: store the authorisation token details
   String[] accessToken = client.getAccessToken();
   System.out.println(accessToken[0] + " " + accessToken[1]);
 }
コード例 #2
0
  //	@Test
  public void tstFollowFollow() throws InterruptedException {
    int lag = 2000; // 300000;
    OAuthSignpostClient client =
        new OAuthSignpostClient(
            OAuthSignpostClient.JTWITTER_OAUTH_KEY,
            OAuthSignpostClient.JTWITTER_OAUTH_SECRET,
            "oob");
    Twitter tw = new Twitter("forkmcguffin", client);
    // open the authorisation page in the user's browser
    client.authorizeDesktop();
    // get the pin
    String v = client.askUser("Please enter the verification PIN from Twitter");
    client.setAuthorizationCode(v);

    User u = tw.follow("winterstein");

    Thread.sleep(lag);

    User u2 = tw.follow("winterstein");
  }