Twitter script since oAuth

Discussion in 'Ruby' started by Jeff Greelish, Sep 17, 2010.

  1. I had a script working with basic authinecation pulling from out local
    database and sending updates to twitter, about 12 a month. Not any
    crazy traffic. Since Aug 31st they turned off basic authineciton. Ive
    tried to implement the follow and it appears to work (pulls back a json
    file per the example. Tested this by puts the line to the screen.

    I can not, figure out how to post an update to it. Im fairly new (well
    not new, but dont do it full time) to programming and I must be missing
    something.

    Here is the script I am following. Bottom of page for the ruby script,
    just cant figure out how to pst an update to the timeline.
    Code:
    # Exchange your oauth_token and oauth_token_secret for an AccessToken
    instance.
    def prepare_access_token(oauth_token, oauth_token_secret)
    consumer = OAuth::Consumer.new("APIKey", "APISecret",
    { :site => "http://api.twitter.com",
    :scheme => :header
    })
    # now create the access token object from passed values
    token_hash = { :oauth_token => oauth_token,
    :oauth_token_secret => oauth_token_secret
    }
    access_token = OAuth::AccessToken.from_hash(consumer, token_hash )
    return access_token
    end
    
    # Exchange our oauth_token and oauth_token secret for the AccessToken
    instance.
    access_token = prepare_access_token("abcdefg", "hijklmnop")
    # use the access token as an agent to get the home timeline
    response = access_token.request(:get,
    "http://api.twitter.com/1/statuses/home_timeline.json")
    
    --
    Posted via http://www.ruby-forum.com/.
     
    Jeff Greelish, Sep 17, 2010
    #1
    1. Advertising

  2. Jeff Greelish

    skim Guest

    [Note: parts of this message were removed to make it a legal post.]

    You can use the twitter gem to post once you have the oauth token or even
    look at this gem that does both http://github.com/moomerman/twitter_oauth

    On Thu, Sep 16, 2010 at 23:46, Jeff Greelish <>wrote:

    > I had a script working with basic authinecation pulling from out local
    > database and sending updates to twitter, about 12 a month. Not any
    > crazy traffic. Since Aug 31st they turned off basic authineciton. Ive
    > tried to implement the follow and it appears to work (pulls back a json
    > file per the example. Tested this by puts the line to the screen.
    >
    > I can not, figure out how to post an update to it. Im fairly new (well
    > not new, but dont do it full time) to programming and I must be missing
    > something.
    >
    > Here is the script I am following. Bottom of page for the ruby script,
    > just cant figure out how to pst an update to the timeline.
    >
    Code:
    > # Exchange your oauth_token and oauth_token_secret for an AccessToken
    > instance.
    > def prepare_access_token(oauth_token, oauth_token_secret)
    >  consumer = OAuth::Consumer.new("APIKey", "APISecret",
    >    { :site => "http://api.twitter.com",
    >      :scheme => :header
    >    })
    >  # now create the access token object from passed values
    >  token_hash = { :oauth_token => oauth_token,
    >                 :oauth_token_secret => oauth_token_secret
    >               }
    >  access_token = OAuth::AccessToken.from_hash(consumer, token_hash )
    >  return access_token
    > end
    >
    > # Exchange our oauth_token and oauth_token secret for the AccessToken
    > instance.
    > access_token = prepare_access_token("abcdefg", "hijklmnop")
    > # use the access token as an agent to get the home timeline
    > response = access_token.request(:get,
    > "http://api.twitter.com/1/statuses/home_timeline.json")
    > 
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    skim, Sep 17, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. xmanclick3
    Replies:
    0
    Views:
    338
    xmanclick3
    Feb 14, 2010
  2. Samuel Sternhagen
    Replies:
    3
    Views:
    200
    Jonas B.
    Jan 18, 2011
  3. Iain Barnett

    Oauth

    Iain Barnett, Jan 20, 2011, in forum: Ruby
    Replies:
    1
    Views:
    125
    Iain Barnett
    Jan 20, 2011
  4. Garrett Smith

    How to login to Twitter via Web (@twitter)

    Garrett Smith, Jul 12, 2010, in forum: Javascript
    Replies:
    2
    Views:
    1,975
    Garrett Smith
    Jul 13, 2010
  5. Demian Brecht

    OAuth 2.0 implementation

    Demian Brecht, Mar 27, 2012, in forum: Python
    Replies:
    18
    Views:
    1,032
    Alec Taylor
    Jul 6, 2012
Loading...

Share This Page