[twitter-dev] OAuth throws HTTPBadResponse error when used to get friends_timeline since_id

2010-08-21 Thread kanny
I am facing very strange and frustrating error.
After generating a successful accessToken through OAuth dance, I try
to retrieve friends_timeline using this ruby snippet:
code
resp = accessToken.get(/1/statuses/friends_timeline.json?
count=300since_id=#{lastid}include_rts=true)
/code
where lastid is read from a persistent storage.
But when run as part of a ruby script, it gives the WRONG STATUS
LINE error:

/usr/local/lib/ruby/1.9.1/net/http.rb:2138:in `read_status_line':
wrong status line: !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0
Transitional//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd\ (Net::HTTPBadResponse)
from /usr/local/lib/ruby/1.9.1/net/http.rb:2125:in `read_new'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1117:in
`transport_request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1103:in `request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1096:in `block in request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:564:in `start'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1094:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/oauth-0.4.2/lib/oauth/
consumer.rb:164:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/oauth-0.4.2/lib/oauth/tokens/
consumer_token.rb:25:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/oauth-0.4.2/lib/oauth/tokens/
access_token.rb:11:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/oauth-0.4.2/lib/oauth/tokens/
access_token.rb:24:in `get'
from ~/src/my_FTL.rb:21:in `main'
---
Surprisingly, if i remove the since_id=#{lastid} part and run the
same script, it works successfully.
More surprisingly, when i run the same line in irb (after putting in
the instructions before that line), it runs fine even with since_id=
parameter.

It is puzzling what causes the error. Since it is a BadResponse error,
it looks like generated from Twitter servers, but only as a response
to a request that could be different from the one working successfully
from irb. On the other hand, inclusion of since_id in the script
must be generating an unservable request??
Any insights on how to fix it would be appreciated as I have to
migrate to OAuth quickly.

Thanks


[twitter-dev] last_read_status_id and last_read_dm_id

2010-08-21 Thread Fabian Schlenz
Hi there.

Anyone who uses Twitter from multiple devices will have noticed one thing: It 
can be really hard to figure out which Tweets he already read and which are 
new. Many clients incorporate some sort of sync-feature between multiple 
clients, but those info isn't available to clients from another publisher. So 
why not save this info in the twitter account-data? Here are some thoughts 
about this:

Tweets have an incrementing ID and (IMO) should mostly be read in the correct 
order. So there is not need to individually track which user read which tweets. 
You could just save the ID of the newest tweet the user read (same goes for DMs 
because they have their own IDs). Tweets with an ID greater than the memorized 
ID would be considered new.

On Twitter's side there would be two new field necessary. Let's for example 
call them last_read_status_id and last_read_dm_id. Also we would need two more 
API endpoints: account/get_last_read_ids, which just returns 
last_read_status_id and last_read_dm_id and account/set_last_read_ids, which 
would take at least one of both values and save them to the Twitter account the 
user is authenticated for.


What do you think? I'd love to see this feature in the twitter API and would 
implement it in my clients ASAP.

Best regards,
Fabian Schlenz   


[twitter-dev] Re: User_Timeline - include_rts not working

2010-08-21 Thread henasraf
Matt,
Any user I show in my app would not show retweets, even if they surely
exist. You can see for yourself at http://wosaic.net/twitguin (still
early stages, don't mind it being a bit lame), see any user such as
myself at http://wosaic.net/twitguin/user/henasraf ; you may go
through pages and see that no retweets ever show; they should be color
coded in orange. You can compare to http://twitter.com/henasraf to see
retweets that should show.

Thanks,
Hen

On Aug 19, 11:34 pm, Matt Harris thematthar...@twitter.com wrote:
 Hey,

 Retweets should be included if they exist in the users timeline when you
 request them. For example if you request 20 Tweets of the timeline and one
 of those last 20 was a retweet - it will be included. If one of the last 20
 Tweets wasn't a retweet it won't be included, even if include_rts is true.

 Does this explain what is happening in your app?
 If not could you give an example of a username which shows this problem.

 Best,
 Matt

 On Thu, Aug 19, 2010 at 1:24 PM, henasraf doku...@gmail.com wrote:
  Hey all, I'm using user_timeline to fetch the timeline of a user in my
  app. Problem is, it doesn't include native Retweets, even though I've
  set include_rts to true. The docs clearly say it should work, but it
  doesn't. What could be the problem? Thanks in advance :)

 --

 Matt Harris
 Developer Advocate, Twitterhttp://twitter.com/themattharris


[twitter-dev] Re: Recent API changes and new fields

2010-08-21 Thread arian
Status.retweet_count!!!
this is perfect!!!
this is exactly what I need. it makes my life easier.

But, I'm testing it right now and I can't find a status where
retweet_count is not blank.

1. There will not be a value for this field when the feature is turned
off
-- how should I know if the feature is turned off or not?

2. the Tweet was created before we added retweet_count support.
-- when exactly this feature was enabled? I'm trying with fresh tweets
but they are all blank yet.

Arian

On 20 ago, 19:45, Matt Harris thematthar...@twitter.com wrote:
 Hey everyone,

 This week we rolled out a couple of new data fields for the status and user
 objects. For a while it has been difficult for you to get the number of
 lists a user is listed in, or the number of times a Tweet has been
 retweeted. You were also finding it hard to know if the user had retweeted
 the status themselves or not. The feature requests you filed and the
 messages on the developer mailing list showed this is a pain point for many
 of you as it uses up many of your hourly API requests.

 These fields are live now and many of you have already seen them in our API
 responses. We intended to tell you about these changes before they were
 live, and in the future for things like this we will, but this time around
 our system for doing that didn't work. The good news is we know what went
 wrong and have made the necessary improvements needed to ensure you are
 notified before the changes happen.

 The recent changes which have been made affect the user and status objects.
 In both cases we have added fields:

 To the user object:
 ---

 listed_count
 represents the number of public lists a user is listed in. This field is an
 integer. As this is a new field it is possible some users will not have a
 listed_count value yet.

 follow_request_sent
 representing whether the user you are authenticating as has requested to
 follow the user you are viewing. This will be false unless the friendship
 request is pending. The field is a boolean and will be true or false.

 To the status object:
 -
 retweet_count
 represents the number of times a status has been retweeted using the Twitter
 retweet action. This field is an integer. There will not be a value for this
 field when the feature is turned off, or the Tweet was created before we
 added retweet_count support.

 retweeted
 represents whether the user you are authenticating as has retweeted this
 status or not. The field is a boolean and can be true or false.

 Changes to existing methods
 --
 users/show
 When requesting data for suspended users the user/show used to return an
 HTTP 404 status code - it now returns HTTP 403.

 This change is in response to number of users who were asking if there was a
 way to know if a user they were getting data for had been deleted or was
 instead suspended. The change means the API agrees with the twitter.com in
 that we confirm a user exists, but that you may not see their information
 because they are suspended.

 If you call /users/show on a suspended user the API response will include
 the error message User has been suspended.

 Please remember we sometimes turn features off to maintain site stability.
 We recommend you always check a field exists before attempting to use it and
 be prepared for the value to be empty. This will help ensure your code stays
 stable if we have to turn features off. We'll also be adding this
 information to the main API documentation soon.

 Best,

 Matt Harris
 Developer Advocate, Twitterhttp://twitter.com/themattharris


[twitter-dev] Re: Getting user timeline statuses_count

2010-08-21 Thread ben.biddington
Thanks, that works perfectly.

bb /

On Aug 20, 4:32 pm, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Hi Ben,

 Looking up the user 
 withhttp://api.twitter.com/1/users/show.xml?screen_name=benbiddingtonwould
 return a statuses_count field for the user.

 Taylor

 On Fri, Aug 20, 2010 at 3:02 AM, ben.biddington 
 ben.bidding...@gmail.comwrote:



  Is there any way to get the statuses_count without making a timeline
  request first?

  Many thanks


[twitter-dev] Re: oauth parameters encoding

2010-08-21 Thread ben.biddington
Have a read of this: http://oauth.net/core/1.0/#encoding_parameters.
It explains everything.

bb /

On Aug 20, 1:17 pm, mostafa farghaly keepon...@gmail.com wrote:
 how to encode the request parameter in the post body, and in the base
 string after getting the access_token and access_token_secret, it will
 be very helpful if you give me the mapping from the reserved
 characters and their percent encoding as my language encoding
 facilities output different results than the twitter oauth guide page.


Re: [twitter-dev] Re: Recent API changes and new fields

2010-08-21 Thread Cameron Kaiser
 Status.retweet_count!!!
 this is perfect!!!
 this is exactly what I need. it makes my life easier.
 
 But, I'm testing it right now and I can't find a status where
 retweet_count is not blank.

Neither can I. Is this turned on?

-- 
 personal: http://www.cameronkaiser.com/ --
  Cameron Kaiser * Floodgap Systems * www.floodgap.com * ckai...@floodgap.com
-- I'm in Pittsburgh. Why am I here? -- Harold Urey, Nobel laureate ---


[twitter-dev] Twitter Bookmarklet on iPad Browser

2010-08-21 Thread zen
DragDrop JavaScript does not work on touchscreen interfaces like
iPad's browser. So, can someone in Twitter put the actual Javascript
that we can copypaste into a bookmark or find another method to add
the Twitter Bookmarklet?

[Please do not suggest that one can dragdrop on the safari browser on
the MacOSX and sync the iPad.]


[twitter-dev] Re: OAuth throws HTTPBadResponse error when used to get friends_timeline since_id

2010-08-21 Thread kanny
Well, it turned out to be one of those micro mistakes. I was reading
the lasttweetid from a file by
code
lastid = open('lasttweetid').read
/code
which was appending an \n at the end thus messing with the request
generation in accessToken.
So, just need to make it
code
lastid = open('lasttweetid').read.strip
/code
and everything is fine.
Now that my pet projects are OAuth-enabled, I can heave a sigh of
relief!


[twitter-dev] Request to better style the Tweet button

2010-08-21 Thread D. Smith
Just a small request: please add the style=cursor: pointer; to the
official Tweet button. It will look better when you mouseover the
button. Tweetmeme button does that.

Also please add the same to the Follow button and other buttons
produced by @Anywhere UI

Thanks!


[twitter-dev] Re: Recent API changes and new fields

2010-08-21 Thread Joe
will we see this in both search and stream API?

On Aug 20, 6:45 pm, Matt Harris thematthar...@twitter.com wrote:
 Hey everyone,

 This week we rolled out a couple of new data fields for the status and user
 objects. For a while it has been difficult for you to get the number of
 lists a user is listed in, or the number of times a Tweet has been
 retweeted. You were also finding it hard to know if the user had retweeted
 the status themselves or not. The feature requests you filed and the
 messages on the developer mailing list showed this is a pain point for many
 of you as it uses up many of your hourly API requests.

 These fields are live now and many of you have already seen them in our API
 responses. We intended to tell you about these changes before they were
 live, and in the future for things like this we will, but this time around
 our system for doing that didn't work. The good news is we know what went
 wrong and have made the necessary improvements needed to ensure you are
 notified before the changes happen.

 The recent changes which have been made affect the user and status objects.
 In both cases we have added fields:

 To the user object:
 ---

 listed_count
 represents the number of public lists a user is listed in. This field is an
 integer. As this is a new field it is possible some users will not have a
 listed_count value yet.

 follow_request_sent
 representing whether the user you are authenticating as has requested to
 follow the user you are viewing. This will be false unless the friendship
 request is pending. The field is a boolean and will be true or false.

 To the status object:
 -
 retweet_count
 represents the number of times a status has been retweeted using the Twitter
 retweet action. This field is an integer. There will not be a value for this
 field when the feature is turned off, or the Tweet was created before we
 added retweet_count support.

 retweeted
 represents whether the user you are authenticating as has retweeted this
 status or not. The field is a boolean and can be true or false.

 Changes to existing methods
 --
 users/show
 When requesting data for suspended users the user/show used to return an
 HTTP 404 status code - it now returns HTTP 403.

 This change is in response to number of users who were asking if there was a
 way to know if a user they were getting data for had been deleted or was
 instead suspended. The change means the API agrees with the twitter.com in
 that we confirm a user exists, but that you may not see their information
 because they are suspended.

 If you call /users/show on a suspended user the API response will include
 the error message User has been suspended.

 Please remember we sometimes turn features off to maintain site stability.
 We recommend you always check a field exists before attempting to use it and
 be prepared for the value to be empty. This will help ensure your code stays
 stable if we have to turn features off. We'll also be adding this
 information to the main API documentation soon.

 Best,

 Matt Harris
 Developer Advocate, Twitterhttp://twitter.com/themattharris


[twitter-dev] single-access Oauth with Javascript

2010-08-21 Thread Claudia
Anyone have any examples? I need to post to a single account from my
web app and the whole thing is built with Javascript/jQuwey/JSON.
Should it be just as easy in Javascript as in PHP or some of the other
examples up there?

Thanks for any tips/help.. new to Oauth so I'm picking through it
slowly.

Claudia


[twitter-dev] Re: Return Public Timeline Tweets based on Geo Location

2010-08-21 Thread Mark W
Bess and Tom,

Thanks for the responses.  The search method seemed to work best for
me.  I appreciate the quick responses.

Mark

On Aug 14, 5:20 pm, Mark W mdwolin...@gmail.com wrote:
 I've searched for a solution, but couldn't find one.

 I'm looking for a way that I can feed in a GeoLocation (Lat,Long) and
 get the latest x tweets posted from around that area.

 statuses/public_timeline doesn't support GeoLocation.

 I looked at search, which can limit the returned amount by
 GeoLocation, however, it requires a query search string, which I don't
 have.

 Any help or friendly point in the right direction is appreciated...

 Thanks.

 Mark