Every repository with this icon (
Every repository with this icon (
| Description: | API wrapper for Twitter and Twitter Search API's edit |
-
Currently there's no way to use twitter gem along with ExtLib gem (which is e.g. used by DataMapper).
Both ExtLib and mash gem (used by twitter) declare separate notions of a Mash class with different semantics. This results in infinite recursion ("stack level too deep" error).
This bug is also posted here: https://mbleigh.lighthouseapp.com/projects/10112-mash/tickets/3-mash-conflicting-with-extlib
Comments
-
[PATCH] "Sign in with Twitter" feature.
3 comments Created 7 months ago by [deleted user]"Sign in with Twitter" is the pattern of authentication that allows users to connect their Twitter account
with third-party services in as little is one click.Comments
[deleted user] Wed May 06 05:00:11 -0700 2009 | linkHmm, it's impossible to attach files here. So I post the patch to gist: http://gist.github.com/107505 , and send it to u by email
-
Potential ambiguity in friendship_create method
2 comments Created 7 months ago by nipunjTwitter has updated the friendship_create method so that it can consume an explicit user_id or screen_name parameter vs the potentially ambiguous "id", which could be either of those values.
Would be best to reflect this specificity in the Twitter gem. (Sorry, I'm a n00b. Wouldn't knwow where to begin.)
Note, I haven't taken a pass over the Twitter API to see if this change was made to other methods that consume "id" as a param.
Thanks.
Comments
jnunemaker
Thu May 14 14:39:45 -0700 2009
| link
I use to name it id_or_screen_name but twitter has changed the method a few times so i just labeled it id. You can still use either a screen_name or an id, the parameter is just named id.
Thanks, John. I get that "id" can be either user_id or screen_name.
But, in the odd case that you have a user_id that's actually the same as an existing screen name, there's ambiguity.
Twitter has tried to disambiguate this by offering explicit "user_id" or "screen_name" params, like so:
http://twitter.com/friendships/create.xml?user_id=1401881
http://twitter.com/friendships/create.xml?screen_name=101010Did I miss it, does the gem's friendship_create method handle these variations as well?
-
In an attempt to use the Twitter gem in my Rails app, I'm being presented with the following exception: uninitialized constant Twitter::OAuth
It occurs when trying to instantiate OAuth.
oauth = Twitter::OAuth.new(ServiceAPIKeys.twitter['api_key'], ServiceAPIKeys.twitter['secret_key'])I have all of the dependencies installed and the gems are unpacked in my vendor/gem directory.
Thoughts?
Comments
Problem found... I was clashing with another vendored gem, Twitter4r. Ugh.
alainravet
Fri Aug 07 05:01:05 -0700 2009
| link
Same problem here, but not the same cause (Twitter4r is not installed on my system.).
I don't know the source of the conflict, but I solved it by inserting 'gem "twitter"', as in :
require 'rubygems'
gem 'twitter' <<--- INSERT THIS
require 'twitter'
It would be a good idea to update the examples to make sure they work for everybody.
-
Twitter dropped /statuses/replies in favor of /statuses/mentions.
Likewise, this branch deprecates #replies in favor of #mentions.
http://github.com/rmm5t/twitter/commits/replies_to_mentionsComments
-
what about adding count option to user_timelime
Comments
I updated the comment, but the option has always been there. You can pass anything option the Twitter API accepts for that method
-
Version constraints for Mash (v0.0.3) and other dependencies
3 comments Created about 1 month ago by mislavTwitter gem should use pessimistic version constraints for dependencies. My proposal:
oauth ~> 0.3.5 mash ~> 0.0.3 httparty ~> 0.4.3Right now the dependencies are:
oauth (>= 0.3.5, runtime) mash (= 0.0.3, runtime) httparty (= 0.4.3, runtime)This means when newer "mash" is released (github version is v0.0.7 now) with much needed bugfixes, twitter gem will currently not load it because it's locked to v0.0.3. With a pessimistic version constraint, it will load any newer 0.0.x version.
Also, currently if an incompatible new OAuth gem is released—let's imagine v0.5.0—twitter gem will load it without second thought and that might break functionality. With a pessimistic version constraint, it will only load newer 0.3.x releases, but never 0.4.0 or higher.
Comments
-
Add support for statuses/home_timeline
1 comment Created about 1 month ago by coderifousFrom Twitter API Wiki:
This home_timeline is identical to statuses/friends_timeline except it also contains retweets, which statuses/friends_timeline does not (for backwards compatibility reasons). In a future version of the API, statuses/friends_timeline will go away and be replaced by home_timeline.
This branch adds support for home timeline:
http://github.com/coderifous/twitter/commits/add_home_timelineComments
-
Can't find how to call this API: http://apiwiki.twitter.com/Twitter+REST+API+Method%3A-blocks-blocking
Please point out if I missed it.Comments
kostya1241
Sat Dec 12 10:54:30 -0800 2009
| link
Yep, thanks, I've seen the "blocked_ids" option.
I was asking if you support exactly "blocks/blocking", that "Returns an array of user objects that the authenticating user is blocking."
kostya1241
Sat Dec 12 11:37:08 -0800 2009
| link
Resolution: supported since version 0.7.10
Thanks pengwynn. -
Not sure if this is an issue with Crack or with this lib, but every time I try to create a friendship, I get this error:
base.friendship_create('anyone') Crack::ParseError: Invalid JSON string
from /Library/Ruby/Gems/1.8/gems/crack-0.1.2/lib/crack/json.rb:14:in `parse' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/request.rb:73:in `parse' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/request.rb:48:in `make_friendly' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/request.rb:34:in `perform' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/request.rb:10:in `post' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/base.rb:162:in `perform_post' from /Library/Ruby/Gems/1.8/gems/twitter-0.6.8/lib/twitter/base.rb:76:in `friendship_create'Comments
-
Methods on Twitter class don't check for errors
0 comments Created 6 months ago by bkocikThe methods on the Twitter class (firehose, friend_ids, follower_ids, status, user) assume that no errors will occur, but all of them can at least return a 50x error. An example using FakeWeb:
>> FakeWeb.register_uri(:get, 'http://twitter.com/statuses/public_timeline.json', ?> :string => '{"request":"\/statuses\/public_timeline.json","error":"Bad gateway"}', ?> :status => ['502', 'Bad Gateway']) => [#["502", "Bad Gateway"], :string=>"{\"request\":\"\\/statuses\\/public_timeline.json\",\"error\":\"Bad gateway\"}"}, @method=:get, @uri="http://twitter.com/statuses/public_timeline.json", @times=1>] >> Twitter.firehose NoMethodError: undefined method `stringify_keys' for ["request", "/statuses/public_timeline.json"]:Array from /usr/lib/ruby/gems/1.8/gems/mash-0.0.3/lib/mash.rb:131:in `deep_update' from /usr/lib/ruby/gems/1.8/gems/mash-0.0.3/lib/mash.rb:50:in `initialize' from /usr/lib/ruby/gems/1.8/gems/twitter-0.6.11/lib/twitter.rb:34:in `new' from /usr/lib/ruby/gems/1.8/gems/twitter-0.6.11/lib/twitter.rb:34:in `firehose'Comments
-
Error handling 404 from Twitter::Search (JSON error)
0 comments Created 6 months ago by chubasWhen you request a search with a :since_id parameter too old, according to Twitter:
This method will return an HTTP 404 error if since_id is used and is too old to be in the search index
which results in a +Crack::ParseError+ exception
Comments
-
stringify_keys error in Mash.new when using Twitter::search
6 comments Created 6 months ago by metrostarhappens periodically, presumably when twitter search services returns a string for a response instead of a hash?
Comments
I had a similar issue on Ubuntu something was funny in Net::HTTP and was sending requests that twitter couldn't process (400 response). Here's what I put in my environment.rb to fix it:
module Twitter
class Searchdef fetch(force=false) if @fetch.nil? || force query = @query.dup query[:q] = query[:q].join(' ') query[:format] = 'json' #This line is the hack and whole reason we're monkey-patching at all. response = self.class.get('http://search.twitter.com/search', :query => query, :format => :json) @fetch = Mash.new(response) end @fetch endend end
labzero. Thanks a bunch. This worked for us! I tried doing a HTTP.new('search.twitter.com', nil).get('/search.json?q=obama') in irb and this would yield the same result. Your patch sidesteps that somehow. This problem just started occuring...I think after the ruby BigDecimal patch on EngineYard I believe, but that may be a coincidence. Any further insights?
Glad it worked for you! I have no idea why it's happening on my Ubuntu servers, they haven't changed and I just started using the twitter gem... The bug didn't happen locally on Leopard.
I've been experiencing this consistently with 2 apps hosted on Heroku. I'll try the patch.
UPDATE: Solved my problem on Heroku! Thanks!This is still acting up for me, even when I drop that code into my code. Still get the error randomly:
/var/lib/gems/1.8/gems/httparty-0.4.3/lib/httparty/response.rb:15:in
send': undefined methodstringify_keys' for #<String:0x7fe66b8cc4a0> (NoMethodError)from /var/lib/gems/1.8/gems/httparty-0.4.3/lib/httparty/response.rb:15:in `method_missing' from /var/lib/gems/1.8/gems/mash-0.0.3/lib/mash.rb:131:in `deep_update' from /var/lib/gems/1.8/gems/mash-0.0.3/lib/mash.rb:50:in `initialize' from pullterm.rb:63:in `new' from pullterm.rb:63:in `fetch' from /var/lib/gems/1.8/gems/twitter-0.6.14/lib/twitter/search.rb:109:in `each' from pullterm.rb:86:in `query_term' from pullterm.rb:127 -
A user-agent is required for twitter searches
0 comments Created 6 months ago by esilverbergI think this may be a new change to twitter, but user-agents are now required or else it will return a 400 Bad Request.
Add this line to work around it for now:
Twitter::Search.default_options = {:headers => {'User-Agent' => 'YOUR_USER_AGENT_STRING'}}Comments
-
Crack seems to have problem's with Twitter's JSON format. If I use the Rails json gem instead, I have no problems.
/Library/Ruby/Gems/1.8/gems/crack-0.1.1/lib/crack/json.rb:14:in `parse': Invalid JSON string (Crack::ParseError)
Comments
I am seeing this error as well (but i'm only using HTTParty, but assuming the issue is the same with the Twitter gem?), but it only seems to be on large data sets (like @barackobama's twitter friends):
/Library/Ruby/Gems/1.8/gems/crack-0.1.3/lib/crack/json.rb:14:in `parse': Invalid JSON string (Crack::ParseError)
Some of it 'seems' to be unicode issues potentially. I've had to write some stuff to get around the followers/tweets that blow it up, but I can't figure out which ones are causing it. Its always the same tweet/user however, which makes me think of some unicode issue causing improper JSON that blows up Crack.
-
list_add_member works just fine but when trying list_remove_user i get
this errorTwitter::RateLimitExceeded: (400): Bad Request - You must specify a
memberWhich is the same error you get if you use the api via curl and leave
off the id
http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-DELETE-list-membersIt has nothing to do with the rate limit. twitter gem just returns all
400's as a ratelimitexceded. There is no rate limit for adding and
removing list items and also my account is white listed.Comments












Ha, I tried to reply at the lighthouse, but that shop has already been closed :)
The problem is fixed e.g. in the peterpunk-mhash gem (http://github.com/peterpunk/mhash/tree/master). It renames Mash to Mhash, resolving the conflict.
This tree no longer seems to exist. Is there another patch available somewhere?
@jefflarkin: http://github.com/peterpunk/mhash/tree/master
I've patched this to use Mhash avoiding the above error http://github.com/deedubs/twitter/tree/master
http://github.com/peterpunk/mhash/tree/master doesn't exist. Does anyone have a copy they can email me? (richcollins@gmail.com)
I've put the version I had online @ http://github.com/deedubs/mHash/tree/master
Just released 0.7.5 that includes a patch from hassox that replaces Mash with its successor Hashie. Hopefully this resolves this issue.
The issue was already resolved when Mike (of Mash) pushed fixed 0.0.x Mash versions. But yeah, in the long run using Hashie is probably better.
To be clear, the issue I was saying was resolved was only this which required the monkeypatch. If you are using twitter 0.7.3 with mash 0.0.6 you still need the
remove_consthack above. So yeah, it's probably just best to use twitter 0.7.5.